gst-libs/gst/audio/gstbaseaudiosink.c: Use gst_base_sink_do_preroll() to wait for PLAYING and before waiting for the ...

Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_sync_latency), (gst_base_audio_sink_render),
(gst_base_audio_sink_callback):
Use gst_base_sink_do_preroll() to wait for PLAYING and before waiting
for the latency to expire, fixes #559567.
This commit is contained in:
Wim Taymans 2008-11-10 14:22:09 +00:00
parent 9b6f3ad0c8
commit e701e64005
2 changed files with 17 additions and 12 deletions

View file

@ -1,3 +1,11 @@
2008-11-10 Wim Taymans <wim.taymans@collabora.co.uk>
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_sync_latency), (gst_base_audio_sink_render),
(gst_base_audio_sink_callback):
Use gst_base_sink_do_preroll() to wait for PLAYING and before waiting
for the latency to expire, fixes #559567.
2008-11-10 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/adder/gstadder.c:

View file

@ -1082,7 +1082,7 @@ gst_base_audio_sink_handle_slaving (GstBaseAudioSink * sink,
/* must be called with LOCK */
static GstFlowReturn
gst_base_audio_sink_sync_latency (GstBaseSink * bsink)
gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj)
{
GstClock *clock;
GstClockReturn status;
@ -1108,12 +1108,9 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink)
do {
GST_DEBUG_OBJECT (sink, "checking preroll");
/* first wait for the playing state before we can continue */
if (G_UNLIKELY (bsink->need_preroll)) {
ret = gst_base_sink_wait_preroll (bsink);
if (ret != GST_FLOW_OK)
goto flushing;
}
ret = gst_base_sink_do_preroll (bsink, obj);
if (ret != GST_FLOW_OK)
goto flushing;
GST_OBJECT_LOCK (sink);
time = sink->priv->us_latency;
@ -1242,12 +1239,12 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
GST_OBJECT_LOCK (sink);
base_time = GST_ELEMENT_CAST (sink)->base_time;
if (G_UNLIKELY (sink->priv->sync_latency)) {
/* only do this once until we are set back to PLAYING */
sink->priv->sync_latency = FALSE;
ret = gst_base_audio_sink_sync_latency (bsink);
ret = gst_base_audio_sink_sync_latency (bsink, GST_MINI_OBJECT_CAST (buf));
GST_OBJECT_UNLOCK (sink);
if (G_UNLIKELY (ret != GST_FLOW_OK))
goto sync_latency_failed;
/* only do this once until we are set back to PLAYING */
sink->priv->sync_latency = FALSE;
} else {
GST_OBJECT_UNLOCK (sink);
}
@ -1644,8 +1641,8 @@ gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
error:
{
GST_WARNING_OBJECT (basesink, "Got flow error but can't return it: %d",
ret);
GST_WARNING_OBJECT (basesink, "Got flow '%s' but can't return it: %d",
gst_flow_get_name (ret), ret);
gst_ring_buffer_pause (rbuf);
GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
return;