mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 12:03:02 +00:00
Request a new IDR frame immediately if we've been waiting for one for 120 frames
This commit is contained in:
parent
c2cdb1264d
commit
c819f2f0e3
@ -33,6 +33,9 @@ public class VideoDepacketizer {
|
|||||||
private ConnectionStatusListener controlListener;
|
private ConnectionStatusListener controlListener;
|
||||||
private final int nominalPacketDataLength;
|
private final int nominalPacketDataLength;
|
||||||
|
|
||||||
|
private static final int CONSECUTIVE_DROP_LIMIT = 120;
|
||||||
|
private int consecutiveFrameDrops = 0;
|
||||||
|
|
||||||
private static final int DU_LIMIT = 15;
|
private static final int DU_LIMIT = 15;
|
||||||
private PopulatedBufferList<DecodeUnit> decodedUnits;
|
private PopulatedBufferList<DecodeUnit> decodedUnits;
|
||||||
|
|
||||||
@ -61,6 +64,22 @@ public class VideoDepacketizer {
|
|||||||
private void dropAvcFrameState()
|
private void dropAvcFrameState()
|
||||||
{
|
{
|
||||||
waitingForIdrFrame = true;
|
waitingForIdrFrame = true;
|
||||||
|
|
||||||
|
// Count the number of consecutive frames dropped
|
||||||
|
consecutiveFrameDrops++;
|
||||||
|
|
||||||
|
// If we reach our limit, immediately request an IDR frame
|
||||||
|
// and reset
|
||||||
|
if (consecutiveFrameDrops == CONSECUTIVE_DROP_LIMIT) {
|
||||||
|
LimeLog.warning("Reached consecutive drop limit");
|
||||||
|
|
||||||
|
// Restart the count
|
||||||
|
consecutiveFrameDrops = 0;
|
||||||
|
|
||||||
|
// Request an IDR frame
|
||||||
|
controlListener.connectionDetectedFrameLoss(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
cleanupAvcFrameState();
|
cleanupAvcFrameState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +145,9 @@ public class VideoDepacketizer {
|
|||||||
|
|
||||||
// Clear old state
|
// Clear old state
|
||||||
cleanupAvcFrameState();
|
cleanupAvcFrameState();
|
||||||
|
|
||||||
|
// Clear frame drops
|
||||||
|
consecutiveFrameDrops = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user