summaryrefslogtreecommitdiff
path: root/libavformat/dashenc.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-05-10 10:05:37 +0300
committerMartin Storsjö <martin@martin.st>2015-05-10 22:57:21 +0300
commitb8d2630c5327d2818d05c8a48be0417905d8e0fd (patch)
tree0cbb273c461cca8f5d8d60d3b1670dae18e61181 /libavformat/dashenc.c
parentac1a1cb948fe29975424e367173b88db48792144 (diff)
dashenc: Reduce the segment duration if cutting out parts with edit lists
This makes sure that the time + duration of the first segment matches the start time of the next segment for e.g. AAC audio with encoder delay. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r--libavformat/dashenc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index f228b86000..cedd83b67b 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -696,9 +696,11 @@ static int add_segment(OutputStream *os, const char *file,
return AVERROR(ENOMEM);
av_strlcpy(seg->file, file, sizeof(seg->file));
seg->time = time;
- if (seg->time < 0) // If pts<0, it is expected to be cut away with an edit list
- seg->time = 0;
seg->duration = duration;
+ if (seg->time < 0) { // If pts<0, it is expected to be cut away with an edit list
+ seg->duration += seg->time;
+ seg->time = 0;
+ }
seg->start_pos = start_pos;
seg->range_length = range_length;
seg->index_length = index_length;