• Martin Storsjö's avatar
    flvdec: Honor the "flv_metadata" option for the "datastream" metadata field · 58ffe0db
    Martin Storsjö authored
    By default the option "flv_metadata" (internally using the field
    name "trust_metadata") is set to 0, meaning that we don't allocate
    streams based on information in the metadata, only based on
    actual streams we encounter. However the "datastream" metadata field
    still would allocate a subtitle stream.
    
    When muxing, the "datastream" field is added if either a data stream
    or subtitle stream is present - but the same metadata field is used
    to preemtively create a subtitle stream only. Thus, if the field
    was added due to a data stream, not a subtitle stream, the demuxer
    would create a stream which won't get any actual packets.
    
    If there was such an extra, empty subtitle stream, running
    avformat_find_stream_info still used to terminate within reasonable
    time before 3749eede. After that
    commit, it no longer would terminate until it reaches the max
    analyze duration, which is 90 seconds for flv streams (see
    e6a08464,
    24fdf733 and
    f58e011a).
    
    Before that commit (which removed the deprecated AVStream.codec), the
    "st->codecpar->codec_id = AV_CODEC_ID_TEXT", set within the demuxer,
    would get propagated into st->codec->codec_id by numerous
    avcodec_parameters_to_context(st->codec, st->codecpar), then further
    into st->internal->avctx->codec_id by update_stream_avctx within
    read_frame_internal in libavformat/utils.c (demux.c these days).
    Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
    58ffe0db
flvdec.c 49.6 KB