amlv4l2dec: CB2 fixed streamon error [1/1]
PD#SWPL-141913
Problem:
amlv4l2dec is processing resolution changed event,at this point
received flush event, it cause gst_video_decoder_negotiate failed,
capture buffer pool don't be actived,so none capture buffer queue
to decoder
Solution:
if amlv4l2dec is processing resolution changed event, blocking
flush event until capture buffer pool actived
Verify:
ap222
Change-Id: Ie8b1c940e3745eecdec03a5403239f885e7eb17d
Signed-off-by: fei.deng <fei.deng@amlogic.com>
diff --git a/src/gstamlv4l2videodec.c b/src/gstamlv4l2videodec.c
index 13e6152..4a275b4 100644
--- a/src/gstamlv4l2videodec.c
+++ b/src/gstamlv4l2videodec.c
@@ -911,7 +911,6 @@
GstVideoInfo info;
GstCaps *acquired_caps, *available_caps, *caps, *filter;
GstStructure *st;
-
GST_DEBUG_OBJECT(self, "waitting source change event");
/* Wait until received SOURCE_CHANGE event to get right video format */
while (self->v4l2capture->can_wait_event && self->v4l2capture->need_wait_event)
@@ -919,6 +918,8 @@
ret = gst_aml_v4l2_object_dqevent(self->v4l2capture);
if (ret == GST_AML_V4L2_FLOW_SOURCE_CHANGE)
{
+ //let flush start event blocked until capture buffer pool actived
+ self->is_res_chg = TRUE;
GST_DEBUG_OBJECT(self, "Received source change event");
break;
}
@@ -1176,7 +1177,13 @@
beach:
GST_DEBUG_OBJECT(decoder, "Leaving output thread: %s",
gst_flow_get_name(ret));
-
+ if (self->is_res_chg) {
+ //unblock flush start event
+ g_mutex_lock(&self->res_chg_lock);
+ self->is_res_chg = FALSE;
+ g_cond_signal(&self->res_chg_cond);
+ g_mutex_unlock(&self->res_chg_lock);
+ }
gst_buffer_replace(&buffer, NULL);
self->output_flow = ret;
gst_aml_v4l2_object_unlock(self->v4l2output);