mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
libs/gst/base/gstbasesink.c: Improve latency query code.
Original commit message from CVS: * libs/gst/base/gstbasesink.c: (gst_base_sink_query_latency), (gst_base_sink_queue_object_unlocked), (gst_base_sink_send_event), (gst_base_sink_change_state): Improve latency query code. Don't leak latency events. * tests/check/gst/gstbin.c: (GST_START_TEST): Improve debugging.
This commit is contained in:
parent
acf6165c5e
commit
b864edefbd
3 changed files with 40 additions and 11 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2007-02-28 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* libs/gst/base/gstbasesink.c: (gst_base_sink_query_latency),
|
||||
(gst_base_sink_queue_object_unlocked), (gst_base_sink_send_event),
|
||||
(gst_base_sink_change_state):
|
||||
Improve latency query code.
|
||||
Don't leak latency events.
|
||||
|
||||
* tests/check/gst/gstbin.c: (GST_START_TEST):
|
||||
Improve debugging.
|
||||
|
||||
2007-02-28 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstelement.c: (gst_element_message_full),
|
||||
|
|
|
@ -688,6 +688,7 @@ gst_base_sink_query_latency (GstBaseSink * sink, gboolean * live,
|
|||
gboolean l, us_live, res;
|
||||
GstClockTime min, max;
|
||||
GstQuery *query;
|
||||
GstClockTime us_min, us_max;
|
||||
|
||||
/* we are live when we sync to the clock */
|
||||
l = gst_base_sink_get_sync (sink);
|
||||
|
@ -700,17 +701,16 @@ gst_base_sink_query_latency (GstBaseSink * sink, gboolean * live,
|
|||
query = gst_query_new_latency ();
|
||||
|
||||
/* ask the peer for the latency */
|
||||
if ((res = gst_base_sink_peer_query (sink, query))) {
|
||||
GstClockTime us_min, us_max;
|
||||
if (!(res = gst_base_sink_peer_query (sink, query)))
|
||||
goto query_failed;
|
||||
|
||||
/* get upstream min and max latency */
|
||||
gst_query_parse_latency (query, &us_live, &us_min, &us_max);
|
||||
if (us_live) {
|
||||
/* upstream live, use its latency, subclasses should use these
|
||||
* values to create the complete latency. */
|
||||
min = us_min;
|
||||
max = us_max;
|
||||
}
|
||||
/* get upstream min and max latency */
|
||||
gst_query_parse_latency (query, &us_live, &us_min, &us_max);
|
||||
if (us_live) {
|
||||
/* upstream live, use its latency, subclasses should use these
|
||||
* values to create the complete latency. */
|
||||
min = us_min;
|
||||
max = us_max;
|
||||
}
|
||||
gst_query_unref (query);
|
||||
|
||||
|
@ -727,7 +727,17 @@ gst_base_sink_query_latency (GstBaseSink * sink, gboolean * live,
|
|||
if (max_latency)
|
||||
*max_latency = max;
|
||||
|
||||
done:
|
||||
gst_query_unref (query);
|
||||
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
query_failed:
|
||||
{
|
||||
GST_DEBUG_OBJECT (sink, "latency query failed");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1841,7 +1851,7 @@ gst_base_sink_queue_object_unlocked (GstBaseSink * basesink, GstPad * pad,
|
|||
o = g_queue_pop_head (q);
|
||||
GST_DEBUG_OBJECT (basesink, "rendering queued object %p", o);
|
||||
|
||||
/* FIXME, do something with the return value? */
|
||||
/* do something with the return value */
|
||||
ret = gst_base_sink_render_object (basesink, pad, o);
|
||||
if (ret != GST_FLOW_OK)
|
||||
goto dequeue_failed;
|
||||
|
@ -2483,7 +2493,10 @@ gst_base_sink_send_event (GstElement * element, GstEvent * event)
|
|||
GST_OBJECT_UNLOCK (element);
|
||||
GST_DEBUG_OBJECT (basesink, "latency set to %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (latency));
|
||||
|
||||
/* don't forward, yet */
|
||||
forward = FALSE;
|
||||
gst_event_unref (event);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -2840,6 +2853,7 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
|
|||
/* if we don't have a preroll buffer we need to wait for a preroll and
|
||||
* return ASYNC. */
|
||||
if (gst_base_sink_is_prerolled (basesink)) {
|
||||
GST_DEBUG_OBJECT (basesink, "PLAYING to PAUSED, we are prerolled");
|
||||
basesink->playing_async = FALSE;
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (basesink, "PLAYING to PAUSED, need preroll");
|
||||
|
|
|
@ -688,9 +688,11 @@ GST_START_TEST (test_children_state_change_order_semi_sink)
|
|||
pop_messages (bus, 4); /* pop playing => paused messages off the bus */
|
||||
pop_messages (bus, 4); /* pop paused => ready messages off the bus */
|
||||
|
||||
GST_DEBUG ("waiting for pipeline to reach refcount 1");
|
||||
while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 1)
|
||||
THREAD_SWITCH ();
|
||||
|
||||
GST_DEBUG ("checking refcount");
|
||||
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
|
||||
ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);
|
||||
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
|
||||
|
@ -698,10 +700,12 @@ GST_START_TEST (test_children_state_change_order_semi_sink)
|
|||
ret = gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to NULL failed");
|
||||
|
||||
GST_DEBUG ("checking refcount");
|
||||
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
|
||||
ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);
|
||||
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
|
||||
|
||||
GST_DEBUG ("cleanup");
|
||||
gst_object_unref (bus);
|
||||
gst_object_unref (pipeline);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue