Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@googlemail.com>2018-11-12 17:18:15 +0300
committerMark Thompson <sw@jkqxz.net>2018-11-14 00:12:28 +0300
commit3c9c9b1568ef6a9babb4237cf8850017ef547668 (patch)
tree085a63ddd9ee0bc309cd5a1e69f280afb48fd755 /libavcodec/h264_metadata_bsf.c
parent959521b58de945ce8aacd4b0ba84958fc192a2c9 (diff)
h264_metadata: Don't use inferred value of buffering frames
Using the value of buffering frames inferred from the old level is not a sensible approach when one wants to guess the level. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com> Signed-off-by: Mark Thompson <sw@jkqxz.net>
Diffstat (limited to 'libavcodec/h264_metadata_bsf.c')
-rw-r--r--libavcodec/h264_metadata_bsf.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index 521bc36b7e..e674f2a88d 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -222,7 +222,7 @@ static int h264_metadata_update_sps(AVBSFContext *bsf,
if (ctx->level == LEVEL_AUTO) {
const H264LevelDescriptor *desc;
int64_t bit_rate;
- int width, height;
+ int width, height, dpb_frames;
if (sps->vui.nal_hrd_parameters_present_flag) {
bit_rate = (sps->vui.nal_hrd_parameters.bit_rate_value_minus1[0] + 1) *
@@ -236,13 +236,16 @@ static int h264_metadata_update_sps(AVBSFContext *bsf,
bit_rate = 0;
}
+ // Don't use max_dec_frame_buffering if it is only inferred.
+ dpb_frames = sps->vui.bitstream_restriction_flag ?
+ sps->vui.max_dec_frame_buffering : H264_MAX_DPB_FRAMES;
+
width = 16 * (sps->pic_width_in_mbs_minus1 + 1);
height = 16 * (sps->pic_height_in_map_units_minus1 + 1) *
(2 - sps->frame_mbs_only_flag);
desc = ff_h264_guess_level(sps->profile_idc, bit_rate,
- width, height,
- sps->vui.max_dec_frame_buffering);
+ width, height, dpb_frames);
if (desc) {
level_idc = desc->level_idc;
} else {