mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 21:07:02 +09:00
decoder: checked init state before reads the vdec status. [1/1]
PD#SWPL-2142 Problem: the kernel maybe crash when swicthed the src channel Solution: checked init state before reads the vdec status Verify: p321 Change-Id: I3b9fc2128615c5b6151915baecb0516a7ebca2f4 Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
This commit is contained in:
@@ -779,6 +779,9 @@ static void vavs_vf_put(struct vframe_s *vf, void *op_arg)
|
||||
|
||||
int vavs_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
if (!(stat & STAT_VDEC_RUN))
|
||||
return 0;
|
||||
|
||||
vstatus->frame_width = frame_width;
|
||||
vstatus->frame_height = frame_height;
|
||||
if (frame_dur != 0)
|
||||
|
||||
@@ -5443,6 +5443,10 @@ int vavs2_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
struct AVS2Decoder_s *dec =
|
||||
(struct AVS2Decoder_s *)vdec->private;
|
||||
|
||||
if (!dec || !(dec->stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = dec->frame_width;
|
||||
vstatus->frame_height = dec->frame_height;
|
||||
|
||||
|
||||
@@ -2263,6 +2263,9 @@ exit:
|
||||
|
||||
int vh264_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
if (!(stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = frame_width;
|
||||
vstatus->frame_height = frame_height;
|
||||
if (frame_dur != 0)
|
||||
|
||||
@@ -5237,6 +5237,10 @@ static void check_timer_func(unsigned long arg)
|
||||
static int dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
struct vdec_h264_hw_s *hw = (struct vdec_h264_hw_s *)vdec->private;
|
||||
|
||||
if (!hw || !(hw->stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = hw->frame_width;
|
||||
vstatus->frame_height = hw->frame_height;
|
||||
if (hw->frame_dur != 0)
|
||||
|
||||
@@ -9078,6 +9078,9 @@ int vh265_dec_status(struct vdec_info *vstatus)
|
||||
#else
|
||||
struct hevc_state_s *hevc = gHevc;
|
||||
#endif
|
||||
if (!hevc || !(hevc->stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = hevc->frame_width;
|
||||
vstatus->frame_height = hevc->frame_height;
|
||||
if (hevc->frame_dur != 0)
|
||||
|
||||
@@ -418,6 +418,9 @@ static void vmjpeg_put_timer_func(unsigned long arg)
|
||||
|
||||
int vmjpeg_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
if (!(stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = frame_width;
|
||||
vstatus->frame_height = frame_height;
|
||||
if (0 != frame_dur)
|
||||
|
||||
@@ -384,6 +384,10 @@ static int vmjpeg_vf_states(struct vframe_states *states, void *op_arg)
|
||||
static int vmjpeg_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
struct vdec_mjpeg_hw_s *hw = (struct vdec_mjpeg_hw_s *)vdec->private;
|
||||
|
||||
if (!hw || !(hw->stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = hw->frame_width;
|
||||
vstatus->frame_height = hw->frame_height;
|
||||
if (0 != hw->frame_dur)
|
||||
|
||||
@@ -1362,6 +1362,9 @@ static void vmpeg_put_timer_func(unsigned long arg)
|
||||
|
||||
int vmpeg12_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
if (!(stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = frame_width;
|
||||
vstatus->frame_height = frame_height;
|
||||
if (frame_dur != 0)
|
||||
|
||||
@@ -1084,8 +1084,10 @@ static int vmmpeg12_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
struct vdec_mpeg12_hw_s *hw =
|
||||
(struct vdec_mpeg12_hw_s *)vdec->private;
|
||||
if (!hw)
|
||||
return 0;
|
||||
|
||||
if (!hw || !(hw->stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = hw->frame_width;
|
||||
vstatus->frame_height = hw->frame_height;
|
||||
if (hw->frame_dur != 0)
|
||||
|
||||
@@ -740,8 +740,9 @@ static void vmpeg_put_timer_func(unsigned long arg)
|
||||
|
||||
int vmpeg4_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
if (NULL == gvs)
|
||||
if (!(stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = vmpeg4_amstream_dec_info.width;
|
||||
vstatus->frame_height = vmpeg4_amstream_dec_info.height;
|
||||
if (0 != vmpeg4_amstream_dec_info.rate)
|
||||
|
||||
@@ -1039,8 +1039,10 @@ static int vmpeg_vf_states(struct vframe_states *states, void *op_arg)
|
||||
static int dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
struct vdec_mpeg4_hw_s *hw = (struct vdec_mpeg4_hw_s *)vdec->private;
|
||||
if (NULL == hw)
|
||||
|
||||
if (!hw || !(hw->stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = hw->vmpeg4_amstream_dec_info.width;
|
||||
vstatus->frame_height = hw->vmpeg4_amstream_dec_info.height;
|
||||
if (0 != hw->vmpeg4_amstream_dec_info.rate)
|
||||
|
||||
@@ -519,6 +519,9 @@ static void vreal_put_timer_func(unsigned long arg)
|
||||
|
||||
int vreal_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
if (!(stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = vreal_amstream_dec_info.width;
|
||||
vstatus->frame_height = vreal_amstream_dec_info.height;
|
||||
if (0 != vreal_amstream_dec_info.rate)
|
||||
|
||||
@@ -721,6 +721,9 @@ static int vvc1_event_cb(int type, void *data, void *private_data)
|
||||
|
||||
int vvc1_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
if (!(stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = vvc1_amstream_dec_info.width;
|
||||
vstatus->frame_height = vvc1_amstream_dec_info.height;
|
||||
if (vvc1_amstream_dec_info.rate != 0)
|
||||
|
||||
@@ -7742,6 +7742,10 @@ int vvp9_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
|
||||
{
|
||||
struct VP9Decoder_s *vp9 =
|
||||
(struct VP9Decoder_s *)vdec->private;
|
||||
|
||||
if (!vp9 || !(vp9->stat & STAT_VDEC_RUN))
|
||||
return -1;
|
||||
|
||||
vstatus->frame_width = frame_width;
|
||||
vstatus->frame_height = frame_height;
|
||||
if (vp9->frame_dur != 0)
|
||||
|
||||
Reference in New Issue
Block a user