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:
parent
063d103dd6
commit
a9429efa34
1 changed files with 4 additions and 1 deletions
|
@ -159,8 +159,11 @@ public class ScreenEncoder implements Device.RotationListener {
|
|||
}
|
||||
|
||||
IO.writeFully(fd, codecBuffer);
|
||||
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) {
|
||||
codec.releaseOutputBuffer(outputBufferId, false);
|
||||
|
|
Loading…
Reference in a new issue