Committed by
GitHub
Fix simulcast factory not sending back EncoderInfo (#67)
正在显示
1 个修改的文件
包含
31 行增加
和
3 行删除
| @@ -2,7 +2,9 @@ package io.livekit.android.webrtc | @@ -2,7 +2,9 @@ package io.livekit.android.webrtc | ||
| 2 | 2 | ||
| 3 | import io.livekit.android.util.LKLog | 3 | import io.livekit.android.util.LKLog |
| 4 | import org.webrtc.* | 4 | import org.webrtc.* |
| 5 | -import java.util.concurrent.* | 5 | +import java.util.concurrent.Callable |
| 6 | +import java.util.concurrent.ExecutorService | ||
| 7 | +import java.util.concurrent.Executors | ||
| 6 | 8 | ||
| 7 | /* | 9 | /* |
| 8 | Copyright 2017, Lyo Kato <lyo.kato at gmail.com> (Original Author) | 10 | Copyright 2017, Lyo Kato <lyo.kato at gmail.com> (Original Author) |
| @@ -49,7 +51,7 @@ internal class SimulcastVideoEncoderFactoryWrapper( | @@ -49,7 +51,7 @@ internal class SimulcastVideoEncoderFactoryWrapper( | ||
| 49 | * This results in HardwareVideoEncoderFactory being both the primary and fallback, | 51 | * This results in HardwareVideoEncoderFactory being both the primary and fallback, |
| 50 | * but there aren't any specific problems in doing so. | 52 | * but there aren't any specific problems in doing so. |
| 51 | */ | 53 | */ |
| 52 | - private class Fallback(private val hardwareVideoEncoderFactory: VideoEncoderFactory) : | 54 | + private class FallbackFactory(private val hardwareVideoEncoderFactory: VideoEncoderFactory) : |
| 53 | VideoEncoderFactory { | 55 | VideoEncoderFactory { |
| 54 | 56 | ||
| 55 | private val softwareVideoEncoderFactory: VideoEncoderFactory = SoftwareVideoEncoderFactory() | 57 | private val softwareVideoEncoderFactory: VideoEncoderFactory = SoftwareVideoEncoderFactory() |
| @@ -93,6 +95,7 @@ internal class SimulcastVideoEncoderFactoryWrapper( | @@ -93,6 +95,7 @@ internal class SimulcastVideoEncoderFactoryWrapper( | ||
| 93 | val future = executor.submit(Callable { | 95 | val future = executor.submit(Callable { |
| 94 | LKLog.i { | 96 | LKLog.i { |
| 95 | """initEncode() thread=${Thread.currentThread().name} [${Thread.currentThread().id}] | 97 | """initEncode() thread=${Thread.currentThread().name} [${Thread.currentThread().id}] |
| 98 | + | encoder=${encoder.implementationName} | ||
| 96 | | streamSettings: | 99 | | streamSettings: |
| 97 | | numberOfCores=${settings.numberOfCores} | 100 | | numberOfCores=${settings.numberOfCores} |
| 98 | | width=${settings.width} | 101 | | width=${settings.width} |
| @@ -165,6 +168,31 @@ internal class SimulcastVideoEncoderFactoryWrapper( | @@ -165,6 +168,31 @@ internal class SimulcastVideoEncoderFactoryWrapper( | ||
| 165 | val future = executor.submit(Callable { return@Callable encoder.implementationName }) | 168 | val future = executor.submit(Callable { return@Callable encoder.implementationName }) |
| 166 | return future.get() | 169 | return future.get() |
| 167 | } | 170 | } |
| 171 | + | ||
| 172 | + override fun createNativeVideoEncoder(): Long { | ||
| 173 | + val future = executor.submit(Callable { return@Callable encoder.createNativeVideoEncoder() }) | ||
| 174 | + return future.get() | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + override fun isHardwareEncoder(): Boolean { | ||
| 178 | + val future = executor.submit(Callable { return@Callable encoder.isHardwareEncoder }) | ||
| 179 | + return future.get() | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + override fun setRates(rcParameters: VideoEncoder.RateControlParameters?): VideoCodecStatus { | ||
| 183 | + val future = executor.submit(Callable { return@Callable encoder.setRates(rcParameters) }) | ||
| 184 | + return future.get() | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + override fun getResolutionBitrateLimits(): Array<VideoEncoder.ResolutionBitrateLimits> { | ||
| 188 | + val future = executor.submit(Callable { return@Callable encoder.resolutionBitrateLimits }) | ||
| 189 | + return future.get() | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + override fun getEncoderInfo(): VideoEncoder.EncoderInfo { | ||
| 193 | + val future = executor.submit(Callable { return@Callable encoder.encoderInfo }) | ||
| 194 | + return future.get() | ||
| 195 | + } | ||
| 168 | } | 196 | } |
| 169 | 197 | ||
| 170 | private class StreamEncoderWrapperFactory(private val factory: VideoEncoderFactory) : | 198 | private class StreamEncoderWrapperFactory(private val factory: VideoEncoderFactory) : |
| @@ -195,7 +223,7 @@ internal class SimulcastVideoEncoderFactoryWrapper( | @@ -195,7 +223,7 @@ internal class SimulcastVideoEncoderFactoryWrapper( | ||
| 195 | sharedContext, enableIntelVp8Encoder, enableH264HighProfile | 223 | sharedContext, enableIntelVp8Encoder, enableH264HighProfile |
| 196 | ) | 224 | ) |
| 197 | primary = StreamEncoderWrapperFactory(hardwareVideoEncoderFactory) | 225 | primary = StreamEncoderWrapperFactory(hardwareVideoEncoderFactory) |
| 198 | - fallback = StreamEncoderWrapperFactory(Fallback(primary)) | 226 | + fallback = StreamEncoderWrapperFactory(FallbackFactory(primary)) |
| 199 | native = SimulcastVideoEncoderFactory(primary, fallback) | 227 | native = SimulcastVideoEncoderFactory(primary, fallback) |
| 200 | } | 228 | } |
| 201 | 229 |
-
请 注册 或 登录 后发表评论