Fix downsize on error before first frame
Retry with a lower definition if MediaCodec fails before the first
frame, not the first packet.
In practice, the first packet is a config packet without any frame, and
MediaCodec might fail just after.
Refs 2eb6fe7d81
Refs #2963 <https://github.com/Genymobile/scrcpy/issues/2963>
This commit is contained in:
@@ -159,7 +159,10 @@ public class ScreenEncoder implements Device.RotationListener {
|
||||
}
|
||||
|
||||
IO.writeFully(fd, codecBuffer);
|
||||
firstFrameSent = true;
|
||||
if ((bufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) == 0) {
|
||||
// If this is not a config packet, then it contains a frame
|
||||
firstFrameSent = true;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (outputBufferId >= 0) {
|
||||
|
||||
Reference in New Issue
Block a user