@@ -31,7 +31,8 @@ public class ScreenEncoder implements Device.RotationListener {
31
31
32
32
private final AtomicBoolean rotationChanged = new AtomicBoolean ();
33
33
34
- private final String videoMimeType ;
34
+ private final Device device ;
35
+ private final VideoStreamer streamer ;
35
36
private final String encoderName ;
36
37
private final List <CodecOption > codecOptions ;
37
38
private final int bitRate ;
@@ -41,8 +42,10 @@ public class ScreenEncoder implements Device.RotationListener {
41
42
private boolean firstFrameSent ;
42
43
private int consecutiveErrors ;
43
44
44
- public ScreenEncoder (String videoMimeType , int bitRate , int maxFps , List <CodecOption > codecOptions , String encoderName , boolean downsizeOnError ) {
45
- this .videoMimeType = videoMimeType ;
45
+ public ScreenEncoder (Device device , VideoStreamer streamer , int bitRate , int maxFps , List <CodecOption > codecOptions , String encoderName ,
46
+ boolean downsizeOnError ) {
47
+ this .device = device ;
48
+ this .streamer = streamer ;
46
49
this .bitRate = bitRate ;
47
50
this .maxFps = maxFps ;
48
51
this .codecOptions = codecOptions ;
@@ -59,7 +62,8 @@ public boolean consumeRotationChange() {
59
62
return rotationChanged .getAndSet (false );
60
63
}
61
64
62
- public void streamScreen (Device device , VideoStreamer streamer ) throws IOException , ConfigurationException {
65
+ public void streamScreen () throws IOException , ConfigurationException {
66
+ String videoMimeType = streamer .getCodec ().getMimeType ();
63
67
MediaCodec codec = createCodec (videoMimeType , encoderName );
64
68
MediaFormat format = createFormat (videoMimeType , bitRate , maxFps , codecOptions );
65
69
IBinder display = createDisplay ();
0 commit comments