summaryrefslogtreecommitdiff
path: root/libavformat/dashenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-17 11:57:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-17 12:05:00 +0100
commit973684a4fba91b9c188b3a19d22e59ffaad79be8 (patch)
tree5a5bc456511c3d58a5e140ab80e8bd478c8920d2 /libavformat/dashenc.c
parentb32cb08b7f43ee017034061eb50273c3596014d5 (diff)
parent456e93bfdd4cbc5e995dea415019abd0703d0e16 (diff)
Merge commit '456e93bfdd4cbc5e995dea415019abd0703d0e16'
* commit '456e93bfdd4cbc5e995dea415019abd0703d0e16': dashenc: Adjust the start time of a segment to the end of the previous segment Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r--libavformat/dashenc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index ec3ceac9af..e11cf69719 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -654,6 +654,7 @@ static int dash_write_header(AVFormatContext *s)
set_codec_str(s, os->ctx->streams[0]->codec, os->codec_str, sizeof(os->codec_str));
os->first_dts = AV_NOPTS_VALUE;
+ os->end_dts = AV_NOPTS_VALUE;
os->segment_index = 1;
}
@@ -863,8 +864,15 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
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, 0);