author | miaohong chen <miaohong.chen@amlogic.com> | 2020-05-07 08:20:03 (GMT) |
---|---|---|
committer | Shen Liu <shen.liu@amlogic.com> | 2020-06-01 11:46:25 (GMT) |
commit | dcb4e45780d03c21490457b48049b6fd4bfbbbe2 (patch) | |
tree | b442f29bffb1540b98ea7d83977cc145fcad808a | |
parent | 925e834e12df4fe864bb8f923037e451b596b38e (diff) | |
download | media_modules-dcb4e45780d03c21490457b48049b6fd4bfbbbe2.zip media_modules-dcb4e45780d03c21490457b48049b6fd4bfbbbe2.tar.gz media_modules-dcb4e45780d03c21490457b48049b6fd4bfbbbe2.tar.bz2 |
vmh264: fix bug of h264 stream stuck [1/1]
PD#SWPL-24006
Problem:
h264 stream stuck.
Solution:
Modify reset judgment condition and
increase counter to avoid misjudgment caused
by subsequent state change
Verify:
u212
Change-Id: Idcdc9ce335561cf0761abeeea11827d50a131720
Signed-off-by: miaohong chen <miaohong.chen@amlogic.com>
-rw-r--r-- | drivers/frame_provider/decoder/h264_multi/vmh264.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/frame_provider/decoder/h264_multi/vmh264.c b/drivers/frame_provider/decoder/h264_multi/vmh264.c index 3b13f79..7a464b4 100644 --- a/drivers/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/frame_provider/decoder/h264_multi/vmh264.c @@ -815,6 +815,8 @@ struct vdec_h264_hw_s { u8 reset_bufmgr_flag; u32 reset_bufmgr_count; + ulong timeout; + u32 timeout_flag; u32 cfg_param1; u32 cfg_param2; u32 cfg_param3; @@ -4635,21 +4637,25 @@ static bool is_buffer_available(struct vdec_s *vdec) (error_proc_policy & 0x8)) { if ((kfifo_len(&hw->display_q) <= 0) && (p_H264_Dpb->mDPB.used_size >= - p_H264_Dpb->mDPB.size - 1) && + (p_H264_Dpb->mDPB.size - 1)) && (p_Dpb->ref_frames_in_buffer > (imax( 1, p_Dpb->num_ref_frames) - p_Dpb->ltref_frames_in_buffer + - force_sliding_margin))) + force_sliding_margin))){ bufmgr_recover(hw); - else + } else { bufmgr_h264_remove_unused_frame(p_H264_Dpb, 1); + } } else if ((error_proc_policy & 0x4) && (kfifo_len(&hw->display_q) <= 0) && ((p_H264_Dpb->mDPB.used_size >= - p_H264_Dpb->mDPB.size - 1) || + (p_H264_Dpb->mDPB.size - 1)) || (!have_free_buf_spec(vdec)))) { enum receviver_start_e state = RECEIVER_INACTIVE; + + if (hw->timeout_flag == false) + hw->timeout = jiffies + HZ / 2; if ((error_proc_policy & 0x10) && vf_get_receiver(vdec->vf_provider_name)) { state = @@ -4661,9 +4667,15 @@ static bool is_buffer_available(struct vdec_s *vdec) state = RECEIVER_INACTIVE; } if (state == RECEIVER_INACTIVE) + hw->timeout_flag = true; + + if (state == RECEIVER_INACTIVE && hw->timeout_flag && + time_after(jiffies, hw->timeout)) { bufmgr_recover(hw); - else + dpb_print(DECODE_ID(hw), 0, "%s %d timeout to reset\n", __func__, __LINE__); + } else { bufmgr_h264_remove_unused_frame(p_H264_Dpb, 1); + } } else if ((error_proc_policy & 0x8) && (p_Dpb->ref_frames_in_buffer > (imax( @@ -4678,6 +4690,9 @@ static bool is_buffer_available(struct vdec_s *vdec) buffer_available = 1; } + if (buffer_available == 1) + hw->timeout_flag = false; + return buffer_available; } |