diff mbox

[FFmpeg-devel,1/3] Fix computation of vs->start_pos

Message ID e4dc476d-380b-2679-82ba-79498775bd5e@hotstar.com
State New
Headers show

Commit Message

Amit Kale Sept. 28, 2018, 6:01 a.m. UTC
Reset vs->start_pos when beginning a new file.

Signed-off-by: Amit Kale<amitk@hotstar.com>
---
  libavformat/hlsenc.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Steven Liu Sept. 28, 2018, 6:10 a.m. UTC | #1
Amit Kale <amitk@hotstar.com> 于2018年9月28日周五 下午2:01写道:
>
> Reset vs->start_pos when beginning a new file.
>
> Signed-off-by: Amit Kale<amitk@hotstar.com>
> ---
>   libavformat/hlsenc.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> Index: ffmpeg/libavformat/hlsenc.c
> ===================================================================
> --- ffmpeg.orig/libavformat/hlsenc.c
> +++ ffmpeg/libavformat/hlsenc.c
> @@ -2289,7 +2289,10 @@ static int hls_write_packet(AVFormatCont
>           }
>
>           if (hls->segment_type != SEGMENT_TYPE_FMP4) {
> -            vs->start_pos = new_start_pos;
> +            if (hls->flags & HLS_SINGLE_FILE)
> +                vs->start_pos = new_start_pos;
maybe it have problem when process the byterange mode and not only
single file mode.
> +            else
> +                vs->start_pos = 0;
>           } else {
>               vs->start_pos += vs->size;
>           }
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Thanks
Amit Kale Sept. 28, 2018, 6:16 a.m. UTC | #2
On Friday 28 September 2018 11:40 AM, Steven Liu wrote:
> Amit Kale <amitk@hotstar.com> 于2018年9月28日周五 下午2:01写道:
>>
>> Reset vs->start_pos when beginning a new file.
>>
>> Signed-off-by: Amit Kale<amitk@hotstar.com>
>> ---
>>    libavformat/hlsenc.c | 5 ++++-
>>    1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> Index: ffmpeg/libavformat/hlsenc.c
>> ===================================================================
>> --- ffmpeg.orig/libavformat/hlsenc.c
>> +++ ffmpeg/libavformat/hlsenc.c
>> @@ -2289,7 +2289,10 @@ static int hls_write_packet(AVFormatCont
>>            }
>>
>>            if (hls->segment_type != SEGMENT_TYPE_FMP4) {
>> -            vs->start_pos = new_start_pos;
>> +            if (hls->flags & HLS_SINGLE_FILE)
>> +                vs->start_pos = new_start_pos;
> maybe it have problem when process the byterange mode and not only
> single file mode.

That's why when HLS_SINGLE_FILE is on, it doesn't change the way vs->start_pos is set. It changes vs->start_pos to 0 only when HLS_SINGLE_FILE isn't used. That way at the beginning of a new segment, vs->start_pos is 0.
-Amit

>> +            else
>> +                vs->start_pos = 0;
>>            } else {
>>                vs->start_pos += vs->size;
>>            }
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> Thanks
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Steven Liu Sept. 28, 2018, 6:48 a.m. UTC | #3
Amit Kale <amitk@hotstar.com> 于2018年9月28日周五 下午2:38写道:
>
> On Friday 28 September 2018 11:40 AM, Steven Liu wrote:
> > Amit Kale <amitk@hotstar.com> 于2018年9月28日周五 下午2:01写道:
> >>
> >> Reset vs->start_pos when beginning a new file.
> >>
> >> Signed-off-by: Amit Kale<amitk@hotstar.com>
> >> ---
> >>    libavformat/hlsenc.c | 5 ++++-
> >>    1 file changed, 4 insertions(+), 1 deletion(-)
> >>
> >> Index: ffmpeg/libavformat/hlsenc.c
> >> ===================================================================
> >> --- ffmpeg.orig/libavformat/hlsenc.c
> >> +++ ffmpeg/libavformat/hlsenc.c
> >> @@ -2289,7 +2289,10 @@ static int hls_write_packet(AVFormatCont
> >>            }
> >>
> >>            if (hls->segment_type != SEGMENT_TYPE_FMP4) {
> >> -            vs->start_pos = new_start_pos;
> >> +            if (hls->flags & HLS_SINGLE_FILE)
> >> +                vs->start_pos = new_start_pos;
> > maybe it have problem when process the byterange mode and not only
> > single file mode.
>
> That's why when HLS_SINGLE_FILE is on, it doesn't change the way vs->start_pos is set. It changes vs->start_pos to 0 only when HLS_SINGLE_FILE isn't used. That way at the beginning of a new segment, vs->start_pos is 0.

Ah, line 2305 have been do this yet.
> -Amit
>
> >> +            else
> >> +                vs->start_pos = 0;
> >>            } else {
> >>                vs->start_pos += vs->size;
> >>            }
> >> _______________________________________________
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > Thanks
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

Index: ffmpeg/libavformat/hlsenc.c
===================================================================
--- ffmpeg.orig/libavformat/hlsenc.c
+++ ffmpeg/libavformat/hlsenc.c
@@ -2289,7 +2289,10 @@  static int hls_write_packet(AVFormatCont
          }
  
          if (hls->segment_type != SEGMENT_TYPE_FMP4) {
-            vs->start_pos = new_start_pos;
+            if (hls->flags & HLS_SINGLE_FILE)
+                vs->start_pos = new_start_pos;
+            else
+                vs->start_pos = 0;
          } else {
              vs->start_pos += vs->size;
          }