From: Peng Yixin Date: Mon, 11 Jan 2021 02:12:56 +0000 (+0800) Subject: media_module: can't get the correct width and height information [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6f4c138a8e98fc9183029d061dd4184f8f40387f;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_media.git media_module: can't get the correct width and height information [1/1] PD#SWPL-40808 Problem: When the width and height of the file exceed the decoding limit, the user layer cannot read the width and height information correctly. Solution: Transmit the width and height information from the header to solve this issue. Verify: AM311 Signed-off-by: Peng Yixin Change-Id: I036eaa410eeff7391cd571a4e08ee201884e4e83 --- diff --git a/drivers/frame_provider/decoder/h264_multi/vmh264.c b/drivers/frame_provider/decoder/h264_multi/vmh264.c index 5389405..b019a38 100644 --- a/drivers/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/frame_provider/decoder/h264_multi/vmh264.c @@ -931,6 +931,8 @@ struct vdec_h264_hw_s { u32 start_bit_cnt; u32 right_frame_count; u32 wrong_frame_count; + u32 error_frame_width; + u32 error_frame_height; }; static u32 again_threshold; @@ -5041,8 +5043,12 @@ static int vh264_set_params(struct vdec_h264_hw_s *hw, seq_info2, mb_width, mb_height); + hw->error_frame_width = mb_width << 4; + hw->error_frame_height = mb_height << 4; return -1; } + hw->error_frame_width = 0; + hw->error_frame_height = 0; if (seq_info2 != 0 && hw->seq_info2 != (seq_info2 & (~0x80000000)) && @@ -7443,6 +7449,11 @@ static int dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) vstatus->frame_width = hw->frame_width; vstatus->frame_height = hw->frame_height; + if (hw->error_frame_width && + hw->error_frame_height) { + vstatus->frame_width = hw->error_frame_width; + vstatus->frame_height = hw->error_frame_height; + } if (hw->frame_dur != 0) { vstatus->frame_dur = hw->frame_dur; vstatus->frame_rate = ((96000 * 10 / hw->frame_dur) % 10) < 5 ? @@ -8740,8 +8751,12 @@ static int vmh264_get_ps_info(struct vdec_h264_hw_s *hw, param1, mb_width, mb_height); + hw->error_frame_width = mb_width << 4; + hw->error_frame_height = mb_height << 4; return -1; } + hw->error_frame_width = 0; + hw->error_frame_height = 0; reorder_pic_num = get_max_dec_frame_buf_size(level_idc, diff --git a/drivers/frame_provider/decoder/h265/vh265.c b/drivers/frame_provider/decoder/h265/vh265.c index 2c6a35e..857a8c1 100644 --- a/drivers/frame_provider/decoder/h265/vh265.c +++ b/drivers/frame_provider/decoder/h265/vh265.c @@ -11808,10 +11808,10 @@ int vh265_dec_status(struct vdec_info *vstatus) if (!hevc) return -1; - vstatus->frame_width = hevc->frame_width; + vstatus->frame_width = hevc->pic_w; /* for hevc interlace for disp height x2 */ vstatus->frame_height = - (hevc->frame_height << hevc->interlace_flag); + (hevc->pic_h << hevc->interlace_flag); if (hevc->frame_dur != 0) vstatus->frame_rate = ((96000 * 10 / hevc->frame_dur) % 10) < 5 ? 96000 / hevc->frame_dur : (96000 / hevc->frame_dur +1); diff --git a/drivers/frame_provider/decoder/vp9/vvp9.c b/drivers/frame_provider/decoder/vp9/vvp9.c index d9a64c2..5d59c42 100644 --- a/drivers/frame_provider/decoder/vp9/vvp9.c +++ b/drivers/frame_provider/decoder/vp9/vvp9.c @@ -1226,6 +1226,8 @@ struct VP9Decoder_s { u64 frame_mode_pts64_save[FRAME_BUFFERS]; int run_ready_min_buf_num; int one_package_frame_cnt; + u32 error_frame_width; + u32 error_frame_height; }; static int vp9_print(struct VP9Decoder_s *pbi, @@ -1322,9 +1324,13 @@ static int setup_frame_size( width = params->p.width; height = params->p.height; if (is_oversize(width, height)) { + pbi->error_frame_width = width; + pbi->error_frame_height = height; vp9_print(pbi, 0, "%s, Error: Invalid frame size\n", __func__); return -1; } + pbi->error_frame_width = 0; + pbi->error_frame_height = 0; /*vp9_read_frame_size(rb, &width, &height);*/ if (print_header_info) @@ -1449,9 +1455,13 @@ static int setup_frame_size_with_refs( } if (is_oversize(width, height)) { + pbi->error_frame_width = width; + pbi->error_frame_height = height; vp9_print(pbi, 0, "%s, Error: Invalid frame size\n", __func__); return -1; } + pbi->error_frame_width = 0; + pbi->error_frame_height = 0; params->p.width = width; params->p.height = height; @@ -9084,6 +9094,12 @@ int vvp9_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) vstatus->frame_width = frame_width; vstatus->frame_height = frame_height; + if (vp9->error_frame_width && + vp9->error_frame_height) { + vstatus->frame_width = vp9->error_frame_width; + vstatus->frame_height = vp9->error_frame_height; + } + if (vp9->frame_dur != 0) vstatus->frame_rate = ((96000 * 10 / vp9->frame_dur) % 10) < 5 ? 96000 / vp9->frame_dur : (96000 / vp9->frame_dur +1);