[FFmpeg-devel] [PATCH 2/4] hlsenc: Fix setting vs->start_pos when not using HLS_SINGLE_FILE or hls_segment_size

Steven Liu lq at chinaffmpeg.org
Mon Jun 24 13:10:04 EEST 2024



> On Jun 24, 2024, at 16:49, Martin Storsjö <martin at martin.st> wrote:
> 
> When not using HLS_SINGLE_FILE or hls_segment_size, we're writing
> each segment into a separate file. In that case, the file start pos for
> each segment will be zero.
> 
> This matches the case in (hls->max_seg_size > 0) above, where we
> decide to switch to a new file.
> 
> This fixes the calculation of "vs->size = new_start_pos - vs->start_pos"
> at the start of hls_write_packet; previously, start_pos would
> refer to the byte size of the previous segment file, giving
> vs->size entirely bogus values here.
> ---
> libavformat/hlsenc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 3d5eb47e84..0c72774e29 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -2659,7 +2659,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
>                 vs->start_pos = new_start_pos;
>             }
>         } else {
> -            vs->start_pos = new_start_pos;
> +            vs->start_pos = 0;
>             sls_flag_file_rename(hls, vs, old_filename);
>             ret = hls_start(s, vs);
>         }
> -- 
> 2.39.3 (Apple Git-146)
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe”.

patchset lgtm

Thanks Martin

Steven




More information about the ffmpeg-devel mailing list