avformat/movenc: don't write a calculated avgBitrate when the provided one is unset

avgBitrate == 0 is used to signal a VBR track, so if that value is propagated by an
encoder, don't overwrite it with a calculated value based on track size.

Part of a fix for ticket #11303.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 944212acad)
release/7.1
James Almer 1 month ago
parent 64e2864cb9
commit 3513ccccb6
  1. 3
      libavformat/movenc.c

@ -737,6 +737,9 @@ static struct mpeg4_bit_rate_values calculate_mpeg4_bit_rates(MOVTrack *track)
// utilize values from properties if we have them available // utilize values from properties if we have them available
if (props) { if (props) {
// no avg_bitrate signals that the track is VBR
if (!props->avg_bitrate)
bit_rates.avg_bit_rate = props->avg_bitrate;
bit_rates.max_bit_rate = FFMAX(bit_rates.max_bit_rate, bit_rates.max_bit_rate = FFMAX(bit_rates.max_bit_rate,
props->max_bitrate); props->max_bitrate);
bit_rates.buffer_size = props->buffer_size / 8; bit_rates.buffer_size = props->buffer_size / 8;

Loading…
Cancel
Save