mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Store packet flags in PTS most significant bits
A special PTS value was used to encode a config packet. To prepare for adding more flags, use the most significant bits of the PTS field to store flags.
This commit is contained in:
parent
29c163959c
commit
e3c2398aa2
2 changed files with 20 additions and 6 deletions
|
|
@ -28,7 +28,7 @@ public class ScreenEncoder implements Device.RotationListener {
|
|||
// Keep the values in descending order
|
||||
private static final int[] MAX_SIZE_FALLBACK = {2560, 1920, 1600, 1280, 1024, 800};
|
||||
|
||||
private static final int NO_PTS = -1;
|
||||
private static final long PACKET_FLAG_CONFIG = 1L << 63;
|
||||
|
||||
private final AtomicBoolean rotationChanged = new AtomicBoolean();
|
||||
private final ByteBuffer headerBuffer = ByteBuffer.allocate(12);
|
||||
|
|
@ -183,7 +183,7 @@ public class ScreenEncoder implements Device.RotationListener {
|
|||
|
||||
long pts;
|
||||
if ((bufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {
|
||||
pts = NO_PTS; // non-media data packet
|
||||
pts = PACKET_FLAG_CONFIG; // non-media data packet
|
||||
} else {
|
||||
if (ptsOrigin == 0) {
|
||||
ptsOrigin = bufferInfo.presentationTimeUs;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue