Handle out of order dts in writeAudioFrame

This commit is contained in:
Isaac Connor 2019-04-15 13:27:13 -04:00
parent f28af7b729
commit 3664084862
1 changed files with 12 additions and 1 deletions

View File

@ -1135,11 +1135,22 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
} }
} // end if encoding or copying } // end if encoding or copying
opkt.pos = -1; opkt.pos = -1;
opkt.stream_index = audio_out_stream->index; opkt.stream_index = audio_out_stream->index;
opkt.flags = ipkt->flags; opkt.flags = ipkt->flags;
if ( opkt.dts > opkt.pts ) { if ( opkt.dts < audio_out_stream->cur_dts ) {
Warning("non increasing dts, fixing");
opkt.dts = audio_out_stream->cur_dts;
if ( opkt.dts > opkt.pts ) {
Debug(1,
"opkt.dts(%" PRId64 ") must be <= opkt.pts(%" PRId64 ")."
"Decompression must happen before presentation.",
opkt.dts, opkt.pts);
opkt.pts = opkt.dts;
}
} else if ( opkt.dts > opkt.pts ) {
Debug(1, Debug(1,
"opkt.dts(%" PRId64 ") must be <= opkt.pts(%" PRId64 ")." "opkt.dts(%" PRId64 ") must be <= opkt.pts(%" PRId64 ")."
"Decompression must happen before presentation.", "Decompression must happen before presentation.",