When dts==last_dts, don't log it as an error. It is too common. Just add duration and move on.

This commit is contained in:
Isaac Connor
2024-06-10 19:11:03 -04:00
parent 2734827d21
commit f90150cf11

View File

@@ -1384,12 +1384,20 @@ int VideoStore::write_packet(AVPacket *pkt, AVStream *stream) {
}
pkt->dts = last_dts[stream->index];
} else {
if ((last_dts[stream->index] != AV_NOPTS_VALUE) and (pkt->dts <= last_dts[stream->index])) {
Warning("non increasing dts, fixing. our dts %" PRId64 " stream %d last_dts %" PRId64 ". reorder_queue_size=%zu",
pkt->dts, stream->index, last_dts[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];
if (pkt->dts > pkt->pts) pkt->pts = pkt->dts; // Do it here to avoid warning below
if (last_dts[stream->index] != AV_NOPTS_VALUE) {
if (pkt->dts < last_dts[stream->index]) {
Warning("non increasing dts, fixing. our dts %" PRId64 " stream %d last_dts %" PRId64 ". reorder_queue_size=%zu",
pkt->dts, stream->index, last_dts[stream->index], reorder_queue_size);
pkt->dts = last_dts[stream->index]+last_duration[stream->index];
if (pkt->dts > pkt->pts) pkt->pts = pkt->dts; // Do it here to avoid warning below
} else if (pkt->dts == last_dts[stream->index]) {
// Commonly seen
Debug(1, "non increasing dts, fixing. our dts %" PRId64 " stream %d last_dts %" PRId64 ". reorder_queue_size=%zu",
pkt->dts, stream->index, last_dts[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];
if (pkt->dts > pkt->pts) pkt->pts = pkt->dts; // Do it here to avoid warning below
}
}
next_dts[stream->index] = pkt->dts + pkt->duration;
last_dts[stream->index] = pkt->dts;