[PORT FROM MAIN] libmix: DPB flushing enhancement
BZ: 70555
For H264, we have extra operation on flush to update DPB.
When entering into h264_dpb_flush_dpb(), we fall into a loop
leading to ANR. The solution is to disable dpb output and add
a dpb size check before updating DPB to avoid ANR issue.
Change-Id: Ie5957247ec269a9916716a799b2278df4a484cc6
Signed-off-by: Tianmi Chen <tianmi.chen@intel.com>
Reviewed-on: http://android.intel.com:8080/81190
Reviewed-by: Ding, Haitao <haitao.ding@intel.com>
Tested-by: Ding, Haitao <haitao.ding@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
diff --git a/mix_vbp/viddec_fw/fw/codecs/h264/parser/h264parse_dpb.c b/mix_vbp/viddec_fw/fw/codecs/h264/parser/h264parse_dpb.c
index 704c180..cb81d27 100755
--- a/mix_vbp/viddec_fw/fw/codecs/h264/parser/h264parse_dpb.c
+++ b/mix_vbp/viddec_fw/fw/codecs/h264/parser/h264parse_dpb.c
@@ -3492,7 +3492,7 @@
// output frames in POC order
if (output_all) {
- while (p_dpb->used_size - keep_complement) {
+ while ((p_dpb->used_size > 0) && (p_dpb->used_size - keep_complement)) {
h264_dpb_queue_update(pInfo, 1, 0, 0,num_ref_frames);
}
}
diff --git a/mix_vbp/viddec_fw/fw/codecs/h264/parser/viddec_h264_parse.c b/mix_vbp/viddec_fw/fw/codecs/h264/parser/viddec_h264_parse.c
index 473c64e..7748b74 100644
--- a/mix_vbp/viddec_fw/fw/codecs/h264/parser/viddec_h264_parse.c
+++ b/mix_vbp/viddec_fw/fw/codecs/h264/parser/viddec_h264_parse.c
@@ -575,8 +575,8 @@
struct h264_viddec_parser* parser = ctxt;
h264_Info * pInfo = &(parser->info);
- /* flush the dpb and output all */
- h264_dpb_flush_dpb(pInfo, 1, pInfo->img.second_field, pInfo->active_SPS.num_ref_frames);
+ /* just flush dpb and disable output */
+ h264_dpb_flush_dpb(pInfo, 0, pInfo->img.second_field, pInfo->active_SPS.num_ref_frames);
/* reset the dpb to the initial state, avoid parser store
wrong data to dpb in next slice parsing */