Opened 4 years ago

Closed 4 years ago

#4900 closed defect (fixed)

HLS flag "delete_segments" errors

Reported by: DeHackEd Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: hls
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Using "ffmpeg ... -hls_flags delete_segments ..." will result in corrupted filenames when trying to delete old segments. The output is something like:
[hls muxer @ 0x3c3a2a0] failed to delete old segment : No such file or directory
[hls muxer @ 0x3c3a2a0] failed to delete old segment ,&q'?zh&1[\S: No such file or directory
[hls muxer @ 0x3c3a2a0] failed to delete old segment AjC<?+*<
<j$: No such file or directory

(Non-ASCII characters have been replaced for readability)

How to reproduce:

% ffmpeg -i testvideo.ts -f hls -c:v libx264 -crf 25 -c:a aac -strict -2 -f hls -hls_flags delete_segments test.m3u8

Once sufficient time has passed errors will be printed regularly.

Tested on current git head

I bisected to identify the faulty commit:
379ddc6af44f0c2f3cb517bcc5664610aef9bfc0
avformat/hlsenc: Add WebVtt? support in hls

Change History (5)

comment:1 Changed 4 years ago by cehoyos

  • Keywords regression added; delete_segments removed
  • Priority changed from normal to important

comment:2 Changed 4 years ago by DeHackEd

  • Keywords regression removed
  • Summary changed from HLS flag "delete_segments" regression to HLS flag "delete_segments" errors

Turns out to not be a regression, unlinking of segments is working. My mistake.

comment:3 Changed 4 years ago by cehoyos

  • Priority changed from important to normal

So what is the issue?

comment:4 Changed 4 years ago by DeHackEd

When no subtitles are in use segment->sub_filename consists of uninitialized/garbage memory. During segment deletion there is no check for whether sub_filename is valid and it attempts to unlink() regardless. This fails and the uninitialized memory block is also printed via av_log for the failure.

I submitted a possible fix to the mailing list.

comment:5 Changed 4 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed

The patch was applied as 76e3f8242d607ac0394b7894196f83f8d02ce5ca
Thank you for the report and the fix!

Note: See TracTickets for help on using tickets.