mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
gst/base/gstbasesink.c: Prepare for doing QOS.
Original commit message from CVS: * gst/base/gstbasesink.c: (gst_base_sink_handle_object), (gst_base_sink_do_sync), (gst_base_sink_handle_buffer): Prepare for doing QOS.
This commit is contained in:
parent
39ca8a97a2
commit
5d5dbe9bc0
3 changed files with 48 additions and 32 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-10-08 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
|
||||||
|
(gst_base_sink_do_sync), (gst_base_sink_handle_buffer):
|
||||||
|
Prepare for doing QOS.
|
||||||
|
|
||||||
2005-10-08 Wim Taymans <wim@fluendo.com>
|
2005-10-08 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* check/gst/gstbin.c: (GST_START_TEST):
|
* check/gst/gstbin.c: (GST_START_TEST):
|
||||||
|
|
|
@ -940,10 +940,10 @@ gst_base_sink_wait (GstBaseSink * basesink, GstClockTime time)
|
||||||
* 4) wait on the clock, this blocks
|
* 4) wait on the clock, this blocks
|
||||||
* 5) unref the clockid again
|
* 5) unref the clockid again
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static GstClockReturn
|
||||||
gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
gboolean result = TRUE;
|
GstClockReturn result = GST_CLOCK_OK;
|
||||||
GstClockTime start, end;
|
GstClockTime start, end;
|
||||||
GstClockTimeDiff stream_start, stream_end;
|
GstClockTimeDiff stream_start, stream_end;
|
||||||
GstBaseSinkClass *bclass;
|
GstBaseSinkClass *bclass;
|
||||||
|
@ -998,7 +998,6 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
||||||
|
|
||||||
/* now do clocking */
|
/* now do clocking */
|
||||||
if (basesink->clock && basesink->sync) {
|
if (basesink->clock && basesink->sync) {
|
||||||
GstClockReturn ret;
|
|
||||||
GstClockTime base_time;
|
GstClockTime base_time;
|
||||||
|
|
||||||
GST_LOCK (basesink);
|
GST_LOCK (basesink);
|
||||||
|
@ -1016,13 +1015,11 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
||||||
else
|
else
|
||||||
basesink->end_time = GST_CLOCK_TIME_NONE;
|
basesink->end_time = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
ret = gst_base_sink_wait (basesink, stream_start + base_time);
|
result = gst_base_sink_wait (basesink, stream_start + base_time);
|
||||||
|
|
||||||
GST_UNLOCK (basesink);
|
GST_UNLOCK (basesink);
|
||||||
|
|
||||||
GST_LOG_OBJECT (basesink, "clock entry done: %d", ret);
|
GST_LOG_OBJECT (basesink, "clock entry done: %d", result);
|
||||||
if (ret == GST_CLOCK_UNSCHEDULED)
|
|
||||||
result = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -1031,7 +1028,7 @@ done:
|
||||||
out_of_segment:
|
out_of_segment:
|
||||||
{
|
{
|
||||||
GST_LOG_OBJECT (basesink, "buffer skipped, not in segment");
|
GST_LOG_OBJECT (basesink, "buffer skipped, not in segment");
|
||||||
return FALSE;
|
return GST_CLOCK_UNSCHEDULED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,16 +1099,24 @@ static inline GstFlowReturn
|
||||||
gst_base_sink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
|
gst_base_sink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
gboolean render;
|
GstClockReturn status;
|
||||||
|
|
||||||
render = gst_base_sink_do_sync (basesink, buf);
|
status = gst_base_sink_do_sync (basesink, buf);
|
||||||
|
switch (status) {
|
||||||
if (render) {
|
case GST_CLOCK_EARLY:
|
||||||
|
GST_DEBUG_OBJECT (basesink, "late frame !");
|
||||||
|
/* fallthrough for now */
|
||||||
|
case GST_CLOCK_OK:
|
||||||
|
{
|
||||||
GstBaseSinkClass *bclass;
|
GstBaseSinkClass *bclass;
|
||||||
|
|
||||||
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
||||||
if (bclass->render)
|
if (bclass->render)
|
||||||
ret = bclass->render (basesink, buf);
|
ret = bclass->render (basesink, buf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (basesink, "buffer unref after render %p", basesink, buf);
|
GST_DEBUG_OBJECT (basesink, "buffer unref after render %p", basesink, buf);
|
||||||
|
|
|
@ -940,10 +940,10 @@ gst_base_sink_wait (GstBaseSink * basesink, GstClockTime time)
|
||||||
* 4) wait on the clock, this blocks
|
* 4) wait on the clock, this blocks
|
||||||
* 5) unref the clockid again
|
* 5) unref the clockid again
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static GstClockReturn
|
||||||
gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
gboolean result = TRUE;
|
GstClockReturn result = GST_CLOCK_OK;
|
||||||
GstClockTime start, end;
|
GstClockTime start, end;
|
||||||
GstClockTimeDiff stream_start, stream_end;
|
GstClockTimeDiff stream_start, stream_end;
|
||||||
GstBaseSinkClass *bclass;
|
GstBaseSinkClass *bclass;
|
||||||
|
@ -998,7 +998,6 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
||||||
|
|
||||||
/* now do clocking */
|
/* now do clocking */
|
||||||
if (basesink->clock && basesink->sync) {
|
if (basesink->clock && basesink->sync) {
|
||||||
GstClockReturn ret;
|
|
||||||
GstClockTime base_time;
|
GstClockTime base_time;
|
||||||
|
|
||||||
GST_LOCK (basesink);
|
GST_LOCK (basesink);
|
||||||
|
@ -1016,13 +1015,11 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
||||||
else
|
else
|
||||||
basesink->end_time = GST_CLOCK_TIME_NONE;
|
basesink->end_time = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
ret = gst_base_sink_wait (basesink, stream_start + base_time);
|
result = gst_base_sink_wait (basesink, stream_start + base_time);
|
||||||
|
|
||||||
GST_UNLOCK (basesink);
|
GST_UNLOCK (basesink);
|
||||||
|
|
||||||
GST_LOG_OBJECT (basesink, "clock entry done: %d", ret);
|
GST_LOG_OBJECT (basesink, "clock entry done: %d", result);
|
||||||
if (ret == GST_CLOCK_UNSCHEDULED)
|
|
||||||
result = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -1031,7 +1028,7 @@ done:
|
||||||
out_of_segment:
|
out_of_segment:
|
||||||
{
|
{
|
||||||
GST_LOG_OBJECT (basesink, "buffer skipped, not in segment");
|
GST_LOG_OBJECT (basesink, "buffer skipped, not in segment");
|
||||||
return FALSE;
|
return GST_CLOCK_UNSCHEDULED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,16 +1099,24 @@ static inline GstFlowReturn
|
||||||
gst_base_sink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
|
gst_base_sink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
gboolean render;
|
GstClockReturn status;
|
||||||
|
|
||||||
render = gst_base_sink_do_sync (basesink, buf);
|
status = gst_base_sink_do_sync (basesink, buf);
|
||||||
|
switch (status) {
|
||||||
if (render) {
|
case GST_CLOCK_EARLY:
|
||||||
|
GST_DEBUG_OBJECT (basesink, "late frame !");
|
||||||
|
/* fallthrough for now */
|
||||||
|
case GST_CLOCK_OK:
|
||||||
|
{
|
||||||
GstBaseSinkClass *bclass;
|
GstBaseSinkClass *bclass;
|
||||||
|
|
||||||
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
||||||
if (bclass->render)
|
if (bclass->render)
|
||||||
ret = bclass->render (basesink, buf);
|
ret = bclass->render (basesink, buf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (basesink, "buffer unref after render %p", basesink, buf);
|
GST_DEBUG_OBJECT (basesink, "buffer unref after render %p", basesink, buf);
|
||||||
|
|
Loading…
Reference in a new issue