Commit 4d835514 authored by Thiago Sousa Santos's avatar Thiago Sousa Santos Committed by Wim Taymans

gst/playback/gstqueue2.c: Wait for preroll before attempting to forward a duration query upstream.

Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_peer_query),
(gst_queue_handle_src_query):
Wait for preroll before attempting to forward a duration query upstream.
Fixes #445505.
parent a6d8c410
2007-06-11 Wim Taymans <wim@fluendo.com>
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_peer_query),
(gst_queue_handle_src_query):
Wait for preroll before attempting to forward a duration query upstream.
Fixes #445505.
2007-06-07 Sebastien Moutte <sebastien@moutte.net>
* gst-libs/gst/rtp/gstbasertpdepayload.c:
common @ 6cb0000a
Subproject commit b5971d76ccd216c27e095c02c3a369a9d05cb36d
Subproject commit 6cb0000a5a30d4fc580a06489106a637fca024c4
......@@ -1391,19 +1391,24 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_queue_handle_src_query (GstPad * pad, GstQuery * query)
gst_queue_peer_query (GstQueue * queue, GstPad * pad, GstQuery * query)
{
GstQueue *queue = GST_QUEUE (GST_PAD_PARENT (pad));
gboolean ret = FALSE;
GstPad *peer;
gboolean res;
if (!(peer = gst_pad_get_peer (queue->sinkpad)))
return FALSE;
if ((peer = gst_pad_get_peer (pad))) {
ret = gst_pad_query (peer, query);
gst_object_unref (peer);
}
return ret;
}
res = gst_pad_query (peer, query);
gst_object_unref (peer);
if (!res)
return FALSE;
static gboolean
gst_queue_handle_src_query (GstPad * pad, GstQuery * query)
{
GstQueue *queue;
queue = GST_QUEUE (GST_PAD_PARENT (pad));
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
......@@ -1411,6 +1416,9 @@ gst_queue_handle_src_query (GstPad * pad, GstQuery * query)
gint64 peer_pos;
GstFormat format;
if (!gst_queue_peer_query (queue, queue->sinkpad, query))
goto peer_failed;
/* get peer position */
gst_query_parse_position (query, &format, &peer_pos);
......@@ -1431,12 +1439,45 @@ gst_queue_handle_src_query (GstPad * pad, GstQuery * query)
gst_query_set_position (query, format, peer_pos);
break;
}
case GST_QUERY_DURATION:
{
GST_DEBUG_OBJECT (queue, "waiting for preroll in duration query");
GST_QUEUE_MUTEX_LOCK (queue);
/* we have to wait until the upstream element is at least paused, which
* happened when we received a first item. */
while (gst_queue_is_empty (queue)) {
GST_QUEUE_WAIT_ADD_CHECK (queue, flushing);
}
GST_QUEUE_MUTEX_UNLOCK (queue);
if (!gst_queue_peer_query (queue, queue->sinkpad, query))
goto peer_failed;
GST_DEBUG_OBJECT (queue, "peer query success");
break;
}
default:
/* peer handled other queries */
if (!gst_queue_peer_query (queue, queue->sinkpad, query))
goto peer_failed;
break;
}
return TRUE;
/* ERRORS */
peer_failed:
{
GST_DEBUG_OBJECT (queue, "failed peer query");
return FALSE;
}
flushing:
{
GST_DEBUG_OBJECT (queue, "flushing while waiting for query");
GST_QUEUE_MUTEX_UNLOCK (queue);
return FALSE;
}
}
static GstFlowReturn
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment