hlsenc: Fix setting vs->start_pos when not using HLS_SINGLE_FILE or hls_segment_size

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.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2024-06-20 16:33:18 +03:00
parent 01312fdfcf
commit 52f57568d5

View File

@ -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);
}