h264_dec: config buf specs after resolution change [1/1]
authorSong Zhao <song.zhao@amlogic.com>
Fri, 26 Jun 2020 06:41:30 +0000 (23:41 -0700)
committerHui Zhang <hui.zhang@amlogic.com>
Wed, 1 Jul 2020 05:05:45 +0000 (22:05 -0700)
PD#SWPL-28501

Problem:
In V4L2 mode, resolution change will trigger reset() and all the
canvas are released with h264_reconfig(). When it continues decoding
the data with new resolution, decoder will write to invalid canvas.

Solution:
In vh264_set_params() call config_buf_specs in V4L2 mode.

Verify:
U212
gst-play-1.0 http://www.bok.net/dash/tears_of_steel/cleartext/stream.mpd

Change-Id: Ia57678e91001d719b9477a62fcae7688455decfd
Signed-off-by: Song Zhao <song.zhao@amlogic.com>
drivers/amvdec_ports/aml_vcodec_dec.c
drivers/frame_provider/decoder/h264_multi/vmh264.c

index 2d426d1ab4340f81d2d4e842b4b32a64dd547043..14d83b0ea9cdceba2b3037c0dd522b625af801c3 100644 (file)
@@ -546,6 +546,8 @@ void trans_vframe_to_user(struct aml_vcodec_ctx *ctx, struct vdec_v4l2_buffer *f
                        if (dstbuf->frame_buffer.num_planes == 2)
                                kernel_write(fp,vb2_plane_vaddr(vb, 1),
                                                vb->planes[1].bytesused, 0);
+                       pr_info("dump idx: %d %dx%d\n", dump_capture_frame, vf->width, vf->height);
+                       dump_capture_frame--;
                        filp_close(fp, NULL);
                }
        }
index b06211d5b0ac47f32cbec9559c6c2bfda7d9acd2..8e877eb3f294b6e9d64ff791da4deb1eb785384b 100644 (file)
@@ -4929,7 +4929,7 @@ static int vh264_set_params(struct vdec_h264_hw_s *hw,
 
                mutex_lock(&vmh264_mutex);
                if (!hw->mmu_enable) {
-                       if (!buffer_reset_flag)
+                       if (!buffer_reset_flag || hw->is_used_v4l)
                                config_buf_specs(vdec);
                        i = get_buf_spec_by_canvas_pos(hw, 0);
 
@@ -9185,6 +9185,8 @@ static void reset(struct vdec_s *vdec)
        hw->eos = 0;
        hw->decode_pic_count = 0;
        hw->dec_result = DEC_RESULT_NONE;
+       /* v4l will reset on every res change */
+       hw->res_ch_flag = 0;
 
        clear_refer_bufs(hw);
        reset_process_time(hw);