amlv4l2dec: CB1 support mpeg2 codec in stream mode [1/1]
PD#SWPL-176551
Problem:
when frames is NULL, the dq will over
Solution:
add protection for frames;
Verify:
ap222
Change-Id: I17304944e41e702e850e6d56ab46aa631ab5311e
Signed-off-by: hanghang.luo <hanghang.luo@amlogic.com>
diff --git a/src/gstamlv4l2videodec.c b/src/gstamlv4l2videodec.c
index 8ae49c5..e7d16af 100644
--- a/src/gstamlv4l2videodec.c
+++ b/src/gstamlv4l2videodec.c
@@ -788,11 +788,12 @@
{
GstVideoCodecFrame *frame = NULL;
GList *frames, *l;
-
+ guint frames_len = 0;
GST_LOG_OBJECT (decoder, "trace in with pts: %" GST_TIME_FORMAT, GST_TIME_ARGS(pts));
- frames = gst_video_decoder_get_frames(decoder);
- guint frames_len = 0;
+ if (!(frames = gst_video_decoder_get_frames(decoder)))
+ goto done;
+
frames_len = g_list_length(frames);
GST_LOG_OBJECT (decoder, "got frames list len:%d", frames_len);
@@ -839,6 +840,7 @@
g_list_free_full(frames, (GDestroyNotify)gst_video_codec_frame_unref);
+done:
GST_LOG_OBJECT (decoder, "trace out ret:%p", frame);
return frame;
}