[FFmpeg-devel] avformat/hlsenc: improve compute after_init_list_dur

Submitted by Steven Liu on July 9, 2018, 9:12 a.m.

Details

Message ID 20180709091231.92133-1-lq@chinaffmpeg.org
State Accepted
Commit bd8a5c6b7ce71c739ab95f6b17e8caeeec2dc9e7
Headers show

Commit Message

Steven Liu July 9, 2018, 9:12 a.m.
fix ticket: 7305
vs->sequence - hls->start_sequence - vs->nb_entries is the
after_init_list_dur fragment numbers
fix the wrong compute way vs->sequence - vs->nb_entries

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steven Liu July 11, 2018, 5:32 a.m.
Steven Liu <lq@chinaffmpeg.org> 于2018年7月9日周一 下午5:12写道:
>
> fix ticket: 7305
> vs->sequence - hls->start_sequence - vs->nb_entries is the
> after_init_list_dur fragment numbers
> fix the wrong compute way vs->sequence - vs->nb_entries
>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/hlsenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 2268f898b0..35a26e8875 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -2178,7 +2178,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
>      if (vs->sequence - vs->nb_entries > hls->start_sequence && hls->init_time > 0) {
>          /* reset end_pts, hls->recording_time at end of the init hls list */
>          int init_list_dur = hls->init_time * vs->nb_entries * AV_TIME_BASE;
> -        int after_init_list_dur = (vs->sequence - vs->nb_entries ) * hls->time * AV_TIME_BASE;
> +        int after_init_list_dur = (vs->sequence - hls->start_sequence - vs->nb_entries ) * (hls->time * AV_TIME_BASE);
>          hls->recording_time = hls->time * AV_TIME_BASE;
>          end_pts = init_list_dur + after_init_list_dur ;
>      }
> --
> 2.15.2 (Apple Git-101.1)
>
>
Pushed


Thanks

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 2268f898b0..35a26e8875 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2178,7 +2178,7 @@  static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
     if (vs->sequence - vs->nb_entries > hls->start_sequence && hls->init_time > 0) {
         /* reset end_pts, hls->recording_time at end of the init hls list */
         int init_list_dur = hls->init_time * vs->nb_entries * AV_TIME_BASE;
-        int after_init_list_dur = (vs->sequence - vs->nb_entries ) * hls->time * AV_TIME_BASE;
+        int after_init_list_dur = (vs->sequence - hls->start_sequence - vs->nb_entries ) * (hls->time * AV_TIME_BASE);
         hls->recording_time = hls->time * AV_TIME_BASE;
         end_pts = init_list_dur + after_init_list_dur ;
     }