@@ -2,7 +2,9 @@ package com.cloudwebrtc.webrtc
2
2
3
3
import android.util.Log
4
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
10
Copyright 2017, Lyo Kato <lyo.kato at gmail.com> (Original Author)
@@ -49,7 +51,7 @@ internal class SimulcastVideoEncoderFactoryWrapper(
49
51
* This results in HardwareVideoEncoderFactory being both the primary and fallback,
50
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
55
VideoEncoderFactory {
54
56
55
57
private val softwareVideoEncoderFactory: VideoEncoderFactory = SoftwareVideoEncoderFactory ()
@@ -93,6 +95,7 @@ internal class SimulcastVideoEncoderFactoryWrapper(
93
95
val future = executor.submit(Callable {
94
96
// LKLog.i {
95
97
// """initEncode() thread=${Thread.currentThread().name} [${Thread.currentThread().id}]
98
+ // | encoder=${encoder.implementationName}
96
99
// | streamSettings:
97
100
// | numberOfCores=${settings.numberOfCores}
98
101
// | width=${settings.width}
@@ -165,6 +168,31 @@ internal class SimulcastVideoEncoderFactoryWrapper(
165
168
val future = executor.submit(Callable { return @Callable encoder.implementationName })
166
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
198
private class StreamEncoderWrapperFactory (private val factory : VideoEncoderFactory ) :
@@ -195,7 +223,7 @@ internal class SimulcastVideoEncoderFactoryWrapper(
195
223
sharedContext, enableIntelVp8Encoder, enableH264HighProfile
196
224
)
197
225
primary = StreamEncoderWrapperFactory (hardwareVideoEncoderFactory)
198
- fallback = StreamEncoderWrapperFactory (Fallback (primary))
226
+ fallback = StreamEncoderWrapperFactory (FallbackFactory (primary))
199
227
native = SimulcastVideoEncoderFactory (primary, fallback)
200
228
}
201
229
0 commit comments