mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Allow the extractor deplete the reordering queue as much as possible.
#minor-release PiperOrigin-RevId: 370673852
This commit is contained in:
parent
26a6aad3e4
commit
537e8aadd5
1 changed files with 10 additions and 4 deletions
|
|
@ -139,8 +139,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
long packetArrivalTimeMs = SystemClock.elapsedRealtime();
|
long packetArrivalTimeMs = SystemClock.elapsedRealtime();
|
||||||
|
long packetCutoffTimeMs = getCutoffTimeMs(packetArrivalTimeMs);
|
||||||
reorderingQueue.offer(packet, packetArrivalTimeMs);
|
reorderingQueue.offer(packet, packetArrivalTimeMs);
|
||||||
@Nullable RtpPacket dequeuedPacket = reorderingQueue.poll(getCutoffTimeMs(packetArrivalTimeMs));
|
@Nullable RtpPacket dequeuedPacket = reorderingQueue.poll(packetCutoffTimeMs);
|
||||||
if (dequeuedPacket == null) {
|
if (dequeuedPacket == null) {
|
||||||
// No packet is available for reading.
|
// No packet is available for reading.
|
||||||
return RESULT_CONTINUE;
|
return RESULT_CONTINUE;
|
||||||
|
|
@ -164,15 +165,20 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
// Ignores the incoming packets while seek is pending.
|
// Ignores the incoming packets while seek is pending.
|
||||||
if (isSeekPending) {
|
if (isSeekPending) {
|
||||||
if (nextRtpTimestamp != C.TIME_UNSET && playbackStartTimeUs != C.TIME_UNSET) {
|
if (nextRtpTimestamp != C.TIME_UNSET && playbackStartTimeUs != C.TIME_UNSET) {
|
||||||
|
reorderingQueue.reset();
|
||||||
payloadReader.seek(nextRtpTimestamp, playbackStartTimeUs);
|
payloadReader.seek(nextRtpTimestamp, playbackStartTimeUs);
|
||||||
isSeekPending = false;
|
isSeekPending = false;
|
||||||
nextRtpTimestamp = C.TIME_UNSET;
|
nextRtpTimestamp = C.TIME_UNSET;
|
||||||
playbackStartTimeUs = C.TIME_UNSET;
|
playbackStartTimeUs = C.TIME_UNSET;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rtpPacketDataBuffer.reset(packet.payloadData);
|
do {
|
||||||
payloadReader.consume(
|
// Deplete the reordering queue as much as possible.
|
||||||
rtpPacketDataBuffer, packet.timestamp, packet.sequenceNumber, packet.marker);
|
rtpPacketDataBuffer.reset(packet.payloadData);
|
||||||
|
payloadReader.consume(
|
||||||
|
rtpPacketDataBuffer, packet.timestamp, packet.sequenceNumber, packet.marker);
|
||||||
|
packet = reorderingQueue.poll(packetCutoffTimeMs);
|
||||||
|
} while (packet != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RESULT_CONTINUE;
|
return RESULT_CONTINUE;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue