[FFmpeg-devel] [PATCH 2/4] hlsenc: Fix setting vs->start_pos when not using HLS_SINGLE_FILE or hls_segment_size
Martin Storsjö
martin at martin.st
Wed Jun 26 13:55:21 EEST 2024
On Mon, 24 Jun 2024, Steven Liu wrote:
>
>
>> 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
Actually, it turns out that patch 2/4 here breaks fmp4 muxing, due to what
seems to be like a bogus if statement in the code. I'll send a new version
of this patchset, with a new added patch 2/5 - please take a look!
// Martin
More information about the ffmpeg-devel
mailing list