mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 19:42:45 +00:00
Fix waiting for IDR frames
This commit is contained in:
parent
debd840db4
commit
f36227b506
@ -91,10 +91,24 @@ public class VideoDepacketizer {
|
|||||||
flags |= DecodeUnit.DU_FLAG_CODEC_CONFIG;
|
flags |= DecodeUnit.DU_FLAG_CODEC_CONFIG;
|
||||||
break;
|
break;
|
||||||
case 0x65:
|
case 0x65:
|
||||||
|
waitingForIdrFrame = false;
|
||||||
flags |= DecodeUnit.DU_FLAG_SYNC_FRAME;
|
flags |= DecodeUnit.DU_FLAG_SYNC_FRAME;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// Other frames types require IDR frames to precede them
|
||||||
|
if (waitingForIdrFrame) {
|
||||||
|
LimeLog.warning("Waiting for IDR frame");
|
||||||
|
dropAvcFrameState();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LimeLog.severe("Internal video depacketizer error: Invalid frame start");
|
||||||
|
controlListener.connectionSinkTooSlow(0, 0);
|
||||||
|
dropAvcFrameState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Construct the H264 decode unit
|
// Construct the H264 decode unit
|
||||||
DecodeUnit du = decodedUnits.pollFreeObject();
|
DecodeUnit du = decodedUnits.pollFreeObject();
|
||||||
@ -162,11 +176,6 @@ public class VideoDepacketizer {
|
|||||||
avcFrameDataChain = new LinkedList<ByteBufferDescriptor>();
|
avcFrameDataChain = new LinkedList<ByteBufferDescriptor>();
|
||||||
avcFrameDataLength = 0;
|
avcFrameDataLength = 0;
|
||||||
packetSet = new HashSet<VideoPacket>();
|
packetSet = new HashSet<VideoPacket>();
|
||||||
|
|
||||||
if (cachedSpecialDesc.data[cachedSpecialDesc.offset+cachedSpecialDesc.length] == 0x65) {
|
|
||||||
// This is the NALU code for I-frame data
|
|
||||||
waitingForIdrFrame = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip the start sequence
|
// Skip the start sequence
|
||||||
@ -175,12 +184,6 @@ public class VideoDepacketizer {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check if this is padding after a full AVC frame
|
|
||||||
if (isDecodingH264 && NAL.isPadding(cachedSpecialDesc)) {
|
|
||||||
// The decode unit is complete
|
|
||||||
reassembleAvcFrame(packet.getFrameIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not decoding AVC
|
// Not decoding AVC
|
||||||
isDecodingH264 = false;
|
isDecodingH264 = false;
|
||||||
|
|
||||||
@ -406,14 +409,6 @@ public class VideoDepacketizer {
|
|||||||
waitingForNextSuccessfulFrame = false;
|
waitingForNextSuccessfulFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we need an IDR frame first, then drop this frame
|
|
||||||
if (waitingForIdrFrame) {
|
|
||||||
LimeLog.warning("Waiting for IDR frame");
|
|
||||||
|
|
||||||
dropAvcFrameState();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
reassembleAvcFrame(frameIndex);
|
reassembleAvcFrame(frameIndex);
|
||||||
|
|
||||||
startFrameNumber = nextFrameNumber;
|
startFrameNumber = nextFrameNumber;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user