media_module: h264 Update the ref queue correctly [1/1]
authorPeng Yixin <yixin.peng@amlogic.com>
Mon, 30 Dec 2019 16:24:00 +0000 (00:24 +0800)
committerHui Zhang <hui.zhang@amlogic.com>
Tue, 7 Jan 2020 10:47:13 +0000 (02:47 -0800)
PD#OTT-7782

Problem:
When there is some error data in the stream, the error ref frame is
forced to be released. Since the list of ref frames is not updated,
decoder driver thinks that the DPB buffer is incorrect and the entire
DPB queue to be cleared, result frame drop.

Solution:
This problem is resolved by updating the list of refs when the
incorrect ref frames are removed to dpb queue.

Verify:
u212

Change-Id: I754434ae1daaaf8df56e9efc10233ca7725df86e
Signed-off-by: Peng Yixin <yixin.peng@amlogic.com>
drivers/frame_provider/decoder/h264_multi/h264_dpb.c

index bbf30a35a4c65648dadeeb6e0659cc644356d333..71560fade20c01a58ee816901149665c658451c0 100644 (file)
@@ -94,6 +94,8 @@ static struct StorablePicture *get_new_pic(
        struct h264_dpb_stru *p_H264_Dpb,
        enum PictureStructure structure, unsigned char is_output);
 
+static void update_ref_list(struct DecodedPictureBuffer *p_Dpb);
+
 static void init_dummy_fs(void)
 {
        dummy_fs.frame = &dummy_pic;
@@ -2120,6 +2122,7 @@ static int unmark_one_error_out_frame(struct h264_dpb_stru *p_H264_Dpb)
                        unmark_for_reference(p_Dpb, p_Dpb->fs[i]);
 
                        ret = 1;
+                       break;
                }
        }
        return ret;
@@ -2165,6 +2168,7 @@ void bufmgr_h264_remove_unused_frame(struct h264_dpb_stru *p_H264_Dpb,
                        dpb_print(p_H264_Dpb->decoder_index,
                                0, "%s, Warnning, force unmark one frame\r\n",
                                __func__);
+                       update_ref_list(p_Dpb);
                        remove_unused_frame_from_dpb(p_H264_Dpb);
                        dump_dpb(p_Dpb, 0);
                }
@@ -2173,6 +2177,7 @@ void bufmgr_h264_remove_unused_frame(struct h264_dpb_stru *p_H264_Dpb,
                        dpb_print(p_H264_Dpb->decoder_index,
                                0, "%s, unmark error frame\r\n",
                                __func__);
+                       update_ref_list(p_Dpb);
                        remove_unused_frame_from_dpb(p_H264_Dpb);
                        dump_dpb(p_Dpb, 0);
                }