Make streamer independent of codec type

Rename VideoStreamer to Streamer, and extract a Codec interface which
will also support audio codecs.
This commit is contained in:
Romain Vimont
2023-02-06 14:52:09 +01:00
parent 440eda15e1
commit 57d68886f4
5 changed files with 39 additions and 11 deletions

View File

@@ -32,7 +32,7 @@ public class ScreenEncoder implements Device.RotationListener {
private final AtomicBoolean rotationChanged = new AtomicBoolean();
private final Device device;
private final VideoStreamer streamer;
private final Streamer streamer;
private final String encoderName;
private final List<CodecOption> codecOptions;
private final int bitRate;
@@ -42,7 +42,7 @@ public class ScreenEncoder implements Device.RotationListener {
private boolean firstFrameSent;
private int consecutiveErrors;
public ScreenEncoder(Device device, VideoStreamer streamer, int bitRate, int maxFps, List<CodecOption> codecOptions, String encoderName,
public ScreenEncoder(Device device, Streamer streamer, int bitRate, int maxFps, List<CodecOption> codecOptions, String encoderName,
boolean downsizeOnError) {
this.device = device;
this.streamer = streamer;
@@ -164,7 +164,7 @@ public class ScreenEncoder implements Device.RotationListener {
return 0;
}
private boolean encode(MediaCodec codec, VideoStreamer streamer) throws IOException {
private boolean encode(MediaCodec codec, Streamer streamer) throws IOException {
boolean eof = false;
MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo();