[FFmpeg-cvslog] Fix bug when incrementing initial_prog_date_time when removing segments

Jesper Ek git at videolan.org
Tue Dec 27 04:12:32 EET 2016


ffmpeg | branch: master | Jesper Ek <deadbeef84 at gmail.com> | Tue Dec 27 10:10:44 2016 +0800| [c7c0046efc3a05e52d0a6da4da9f0beae47c0847] | committer: Jesper Ek

Fix bug when incrementing initial_prog_date_time when removing segments

initial_prog_date_time shouldn't be adjusted when deleting segments
from disk, but rather when segments are removed from the playlist.

Signed-off-by: Jesper Ek <deadbeef84 at gmail.com>
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c7c0046efc3a05e52d0a6da4da9f0beae47c0847
---

 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e46e9b4..648e775 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -185,7 +185,6 @@ static int hls_delete_old_segments(HLSContext *hls) {
     segment = hls->old_segments;
     while (segment) {
         playlist_duration -= segment->duration;
-        hls->initial_prog_date_time += segment->duration;
         previous_segment = segment;
         segment = previous_segment->next;
         if (playlist_duration <= -previous_segment->duration) {
@@ -414,6 +413,7 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double
 
     if (hls->max_nb_segments && hls->nb_entries >= hls->max_nb_segments) {
         en = hls->segments;
+        hls->initial_prog_date_time += en->duration;
         hls->segments = en->next;
         if (en && hls->flags & HLS_DELETE_SEGMENTS &&
                 !(hls->flags & HLS_SINGLE_FILE || hls->wrap)) {



More information about the ffmpeg-cvslog mailing list