diff mbox

[FFmpeg-devel,5/5] avformat:hlsenc.c: fix the output's duration smaller than input's in sub-range mode.

Message ID 20181011085647.81329-5-liuchh83@gmail.com
State Accepted
Commit 1ff4bd59dfcea26b584e8c82a6cd7c3ee87fc8a7
Headers show

Commit Message

Charles Liu Oct. 11, 2018, 8:56 a.m. UTC
In fmp4 & sub-range mode, the output's duration always smaller than expected, because the size of the last #EXT-X-BYTERANGE is too small.

Signed-off-by: Charles Liu <liuchh83@gmail.com>
---
 libavformat/hlsenc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Liu Steven Oct. 16, 2018, 3:17 a.m. UTC | #1
> 在 2018年10月11日,下午4:56,Charles Liu <liuchh83@gmail.com> 写道:
> 
> In fmp4 & sub-range mode, the output's duration always smaller than expected, because the size of the last #EXT-X-BYTERANGE is too small.
> 
> Signed-off-by: Charles Liu <liuchh83@gmail.com>
> ---
> libavformat/hlsenc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 8b3a9b78f4..f8f060d065 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -2380,6 +2380,7 @@ static int hls_write_trailer(struct AVFormatContext *s)
>           if (ret < 0) {
>               goto failed;
>           }
> +            vs->size = range_length;
>           ff_format_io_close(s, &vs->out);
>       }
> 
> @@ -2388,8 +2389,6 @@ failed:
>       if (oc->pb) {
>           if (hls->segment_type != SEGMENT_TYPE_FMP4) {
>               vs->size = avio_tell(vs->avf->pb) - vs->start_pos;
> -            } else {
> -                vs->size = avio_tell(vs->avf->pb);
>           }
>           if (hls->segment_type != SEGMENT_TYPE_FMP4)
>               ff_format_io_close(s, &oc->pb);
> -- 
> 2.19.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Patchset will be pushed if there have no objections :)
Steven Liu Oct. 30, 2018, 3:14 a.m. UTC | #2
Liu Steven <lq@chinaffmpeg.org> 于2018年10月16日周二 上午11:17写道:
>
>
>
> > 在 2018年10月11日,下午4:56,Charles Liu <liuchh83@gmail.com> 写道:
> >
> > In fmp4 & sub-range mode, the output's duration always smaller than expected, because the size of the last #EXT-X-BYTERANGE is too small.
> >
> > Signed-off-by: Charles Liu <liuchh83@gmail.com>
> > ---
> > libavformat/hlsenc.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> > index 8b3a9b78f4..f8f060d065 100644
> > --- a/libavformat/hlsenc.c
> > +++ b/libavformat/hlsenc.c
> > @@ -2380,6 +2380,7 @@ static int hls_write_trailer(struct AVFormatContext *s)
> >           if (ret < 0) {
> >               goto failed;
> >           }
> > +            vs->size = range_length;
> >           ff_format_io_close(s, &vs->out);
> >       }
> >
> > @@ -2388,8 +2389,6 @@ failed:
> >       if (oc->pb) {
> >           if (hls->segment_type != SEGMENT_TYPE_FMP4) {
> >               vs->size = avio_tell(vs->avf->pb) - vs->start_pos;
> > -            } else {
> > -                vs->size = avio_tell(vs->avf->pb);
> >           }
> >           if (hls->segment_type != SEGMENT_TYPE_FMP4)
> >               ff_format_io_close(s, &oc->pb);
> > --
> > 2.19.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> Patchset will be pushed if there have no objections :)

Pushed

Thanks
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 8b3a9b78f4..f8f060d065 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2380,6 +2380,7 @@  static int hls_write_trailer(struct AVFormatContext *s)
             if (ret < 0) {
                 goto failed;
             }
+            vs->size = range_length;
             ff_format_io_close(s, &vs->out);
         }
 
@@ -2388,8 +2389,6 @@  failed:
         if (oc->pb) {
             if (hls->segment_type != SEGMENT_TYPE_FMP4) {
                 vs->size = avio_tell(vs->avf->pb) - vs->start_pos;
-            } else {
-                vs->size = avio_tell(vs->avf->pb);
             }
             if (hls->segment_type != SEGMENT_TYPE_FMP4)
                 ff_format_io_close(s, &oc->pb);