If we try to write a packet with dts == AV_NOPTS_VALUE, set it to stream->cur_dts. This might at least give us a playable file.

This commit is contained in:
Isaac Connor 2019-10-11 14:04:51 -04:00
parent 3b586a2abe
commit 90d6e11fb9
1 changed files with 5 additions and 0 deletions

View File

@ -996,6 +996,11 @@ int VideoStore::write_packet(AVPacket *pkt, AVStream *stream) {
pkt->pos = -1;
pkt->stream_index = stream->index;
if ( pkt->dts == AV_NOPTS_VALUE ) {
Debug(1, "undef dts, fixing by setting to stream cur_dts %" PRId64, stream->cur_dts);
pkt->dts = stream->cur_dts;
}
if ( pkt->dts < stream->cur_dts ) {
Debug(1, "non increasing dts, fixing. our dts %" PRId64 " stream cur_dts %" PRId64, pkt->dts, stream->cur_dts);
pkt->dts = stream->cur_dts;