• Anssi Hannula's avatar
    avformat/hls: Fix missing streams in some cases with MPEG TS · 04964ac3
    Anssi Hannula authored
    HLS demuxer calls the subdemuxer avformat_find_stream_info() while
    overriding the subdemuxer AVFMTCTX_NOHEADER flag by clearing it.
    However, this prevents some streams in some MPEG TS streams from being
    detected properly.
    
    Simply removing the clearing of the flag would cause the inner
    avformat_find_stream_info() call to take longer in some cases, without
    a way to control it.
    
    To fix the issue, do not clear the flag but propagate it to HLS demuxer.
    To avoid the above-mentioned mandatory delay, the call to
    avformat_find_stream_info() is dropped except in the HLS ID3 timestamped
    case. The HLS demuxer user should be calling avformat_find_stream_info()
    on the HLS demuxer if it wants to find the stream info.
    
    The main streams are now created dynamically after read_header time if
    the subdemuxer uses AVFMTCTX_NOHEADER (mpegts).
    
    Subdemuxer avformat_find_stream_info() is still called for the HLS ID3
    timestamped case as the HLS demuxer needs to know the packet durations
    to properly interleave ID3 timestamped streams with MPEG TS streams on
    sub-segment level.
    
    Fixes ticket #4930.
    04964ac3
hls.c 70 KB