fix: use +1 instead of +last_duration for equal DTS fixup
When two packets have the same DTS (common with B-frames near keyframes), bumping by last_duration overshoots and causes a cascading misalignment where every subsequent packet triggers a "non increasing dts" warning with a growing gap. The comment already said "add 1" but the code used last_duration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>pull/4691/head
parent
1b689d6e67
commit
d2a26aee59
|
|
@ -1497,7 +1497,7 @@ int VideoStore::write_packet(AVPacket *pkt, AVStream *stream) {
|
|||
Debug(1, "non increasing dts, fixing. our dts %" PRId64 " stream %d last_dts %" PRId64 " stream %d. reorder_queue_size=%zu",
|
||||
pkt->dts, stream->index, last_dts[stream->index], stream->index, reorder_queue_size);
|
||||
// dts MUST monotonically increase, so add 1 which should be a small enough time difference to not matter.
|
||||
pkt->dts = last_dts[stream->index]+last_duration[stream->index];
|
||||
pkt->dts = last_dts[stream->index]+1;
|
||||
if (pkt->dts > pkt->pts) pkt->pts = pkt->dts; // Do it here to avoid warning below
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue