Merge commit '456e93bfdd4cbc5e995dea415019abd0703d0e16'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 17 Dec 2014 10:57:35 +0000 (11:57 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 17 Dec 2014 11:05:00 +0000 (12:05 +0100)
* commit '456e93bfdd4cbc5e995dea415019abd0703d0e16':
  dashenc: Adjust the start time of a segment to the end of the previous segment

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
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)