From: Michael Niedermayer Date: Wed, 17 Dec 2014 10:57:35 +0000 (+0100) Subject: Merge commit '456e93bfdd4cbc5e995dea415019abd0703d0e16' X-Git-Tag: android-x86-6.0-r1~1371 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=973684a4fba91b9c188b3a19d22e59ffaad79be8;p=android-x86%2Fexternal-ffmpeg.git Merge commit '456e93bfdd4cbc5e995dea415019abd0703d0e16' * commit '456e93bfdd4cbc5e995dea415019abd0703d0e16': dashenc: Adjust the start time of a segment to the end of the previous segment Merged-by: Michael Niedermayer --- 973684a4fba91b9c188b3a19d22e59ffaad79be8 diff --cc libavformat/dashenc.c index ec3ceac9af,b4fd1949e7..e11cf69719 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@@ -863,11 -862,18 +864,18 @@@ static int dash_write_packet(AVFormatCo return ret; } - if (!os->packets_written) - os->start_dts = pkt->dts; + if (!os->packets_written) { + // If we wrote a previous segment, adjust the start time of the segment + // to the end of the previous one (which is the same as the mp4 muxer + // does). This avoids gaps in the timeline. + if (os->end_dts != AV_NOPTS_VALUE) + os->start_dts = os->end_dts; + else + os->start_dts = pkt->dts; + } os->end_dts = pkt->dts + pkt->duration; os->packets_written++; - return ff_write_chained(os->ctx, 0, pkt, s); + return ff_write_chained(os->ctx, 0, pkt, s, 0); } static int dash_write_trailer(AVFormatContext *s)