[FFmpeg-devel] Fig bug when incrementing initial_prog_date_time when

Submitted by Robert Nagy on Dec. 17, 2016, 7:57 a.m.

Details

Message ID CALdTkGEvqEQdzH2ekekXF+rpjP=fbVWepg2yJE9-YSsmORx3Ug@mail.gmail.com
State New
Headers show

Commit Message

Robert Nagy Dec. 17, 2016, 7:57 a.m.
From 8b7499f6ddb32bd1f9ee5f2413bf30664af58799 Mon Sep 17 00:00:00 2001
From: Jesper Ek <deadbeef84@gmail.com>
Date: Wed, 7 Dec 2016 15:56:33 +0100
Subject: [PATCH] Fig 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.
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

                 !(hls->flags & HLS_SINGLE_FILE || hls->wrap)) {

Comments

Steven Liu Dec. 27, 2016, 2:14 a.m.
2016-12-17 15:57 GMT+08:00 Robert Nagy <ronag89@gmail.com>:

> From 8b7499f6ddb32bd1f9ee5f2413bf30664af58799 Mon Sep 17 00:00:00 2001
> From: Jesper Ek <deadbeef84@gmail.com>
> Date: Wed, 7 Dec 2016 15:56:33 +0100
> Subject: [PATCH] Fig 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.
> ---
>  libavformat/hlsenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index acf3a30..d03cf02 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)) {
> --
> 2.10.0
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


applied!



and fix patch typo.


Thanks!

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index acf3a30..d03cf02 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 &&