This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 055cc2024d0b0d762e1953ba923e2f95b7e8e7ed Author: Kacper Michajłow <[email protected]> AuthorDate: Mon Aug 17 15:10:03 2026 +0200 Commit: Kacper Michajłow <[email protected]> CommitDate: Tue Sep 8 20:00:11 2026 +0000 avformat/hls: fix variant_bitrate on streams shared by multiple variants The -1 sentinel marking inconsistent bandwidths was overwritten by the next variant containing the same playlist. Depending on the number of variants the tag ended up unset or set to the last variant's bandwidth. Use a distinct sentinel for the mismatch so shared streams are never tagged. The stream-level variant_bitrate is kept for backward compatibility and should not be relied upon. It can be missing, and its value describes the whole variant rather than the stream itself. The per-variant value is always available in the program metadata. Signed-off-by: Kacper Michajłow <[email protected]> --- doc/demuxers.texi | 4 +++- libavformat/avformat.h | 4 +++- libavformat/hls.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 8603069949..cd3e88f59e 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -554,7 +554,9 @@ The id field is set to the bitrate variant index number. By setting the discard flags on AVStreams (by pressing 'a' or 'v' in ffplay), the caller can decide which variant streams to actually receive. The total bitrate of the variant that the stream belongs to is -available in a metadata key named "variant_bitrate". +available in a metadata key named "variant_bitrate". It is unset when +the stream is shared by variants with different bitrates. The value is +always available in the corresponding program's metadata. It accepts the following options: diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 9df6459f91..4682e105e8 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -421,7 +421,9 @@ struct AVFrame; service_provider -- name of the service provider in broadcasting. title -- name of the work. track -- number of this work in the set, can be in form current/total. - variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of + variant_bitrate -- the total bitrate of the bitrate variant that the program + represents or that the current stream is part of. On + streams it is only set when unambiguous. @endverbatim * * Look in the examples section for an application example how to use the Metadata API. diff --git a/libavformat/hls.c b/libavformat/hls.c index c7b80a4cdd..daca226f67 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -2176,10 +2176,10 @@ static void add_stream_to_programs(AVFormatContext *s, struct playlist *pls, AVS av_program_add_stream_index(s, i, stream->index); - if (bandwidth < 0) + if (bandwidth == -1) bandwidth = v->bandwidth; else if (bandwidth != v->bandwidth) - bandwidth = -1; /* stream in multiple variants with different bandwidths */ + bandwidth = -2; /* stream in multiple variants with different bandwidths */ } } -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
