mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
gst-libs/gst/audio/gstaudiosink.c: Improve debug output.
Original commit message from CVS: * gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func), (gst_audioringbuffer_open_device), (gst_audioringbuffer_close_device), (gst_audioringbuffer_acquire), (gst_audioringbuffer_release), (gst_audioringbuffer_start), (gst_audioringbuffer_pause), (gst_audioringbuffer_stop), (gst_audio_sink_create_ringbuffer): Improve debug output. * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_start), (gst_ring_buffer_pause), (gst_ring_buffer_delay): Prevent some functions from doing things and failing when the ringbuffer is not yet acquired.
This commit is contained in:
parent
c25cb3fc98
commit
355e8a940d
3 changed files with 60 additions and 20 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2007-12-18 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func),
|
||||
(gst_audioringbuffer_open_device),
|
||||
(gst_audioringbuffer_close_device), (gst_audioringbuffer_acquire),
|
||||
(gst_audioringbuffer_release), (gst_audioringbuffer_start),
|
||||
(gst_audioringbuffer_pause), (gst_audioringbuffer_stop),
|
||||
(gst_audio_sink_create_ringbuffer):
|
||||
Improve debug output.
|
||||
|
||||
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_start),
|
||||
(gst_ring_buffer_pause), (gst_ring_buffer_delay):
|
||||
Prevent some functions from doing things and failing when the
|
||||
ringbuffer is not yet acquired.
|
||||
|
||||
2007-12-18 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
* gst-libs/gst/interfaces/interfaces.h:
|
||||
|
|
|
@ -262,13 +262,13 @@ audioringbuffer_thread_func (GstRingBuffer * buf)
|
|||
/* ERROR */
|
||||
no_function:
|
||||
{
|
||||
GST_DEBUG ("no write function, exit thread");
|
||||
GST_DEBUG_OBJECT (sink, "no write function, exit thread");
|
||||
return;
|
||||
}
|
||||
stop_running:
|
||||
{
|
||||
GST_OBJECT_UNLOCK (abuf);
|
||||
GST_DEBUG ("stop running, exit thread");
|
||||
GST_DEBUG_OBJECT (sink, "stop running, exit thread");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ gst_audioringbuffer_open_device (GstRingBuffer * buf)
|
|||
|
||||
could_not_open:
|
||||
{
|
||||
GST_DEBUG ("could not open device");
|
||||
GST_DEBUG_OBJECT (sink, "could not open device");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ gst_audioringbuffer_close_device (GstRingBuffer * buf)
|
|||
|
||||
could_not_close:
|
||||
{
|
||||
GST_DEBUG ("could not close device");
|
||||
GST_DEBUG_OBJECT (sink, "could not close device");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ gst_audioringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
|||
|
||||
could_not_prepare:
|
||||
{
|
||||
GST_DEBUG ("could not prepare device");
|
||||
GST_DEBUG_OBJECT (sink, "could not prepare device");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ gst_audioringbuffer_release (GstRingBuffer * buf)
|
|||
abuf = GST_AUDIORING_BUFFER_CAST (buf);
|
||||
|
||||
abuf->running = FALSE;
|
||||
GST_DEBUG ("signal wait");
|
||||
GST_DEBUG_OBJECT (sink, "signal wait");
|
||||
GST_AUDIORING_BUFFER_SIGNAL (buf);
|
||||
GST_OBJECT_UNLOCK (buf);
|
||||
|
||||
|
@ -426,7 +426,7 @@ gst_audioringbuffer_release (GstRingBuffer * buf)
|
|||
|
||||
could_not_unprepare:
|
||||
{
|
||||
GST_DEBUG ("could not unprepare device");
|
||||
GST_DEBUG_OBJECT (sink, "could not unprepare device");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ gst_audioringbuffer_start (GstRingBuffer * buf)
|
|||
|
||||
sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
|
||||
|
||||
GST_DEBUG ("start, sending signal");
|
||||
GST_DEBUG_OBJECT (sink, "start, sending signal");
|
||||
GST_AUDIORING_BUFFER_SIGNAL (buf);
|
||||
|
||||
return TRUE;
|
||||
|
@ -455,9 +455,9 @@ gst_audioringbuffer_pause (GstRingBuffer * buf)
|
|||
|
||||
/* unblock any pending writes to the audio device */
|
||||
if (csink->reset) {
|
||||
GST_DEBUG ("reset...");
|
||||
GST_DEBUG_OBJECT (sink, "reset...");
|
||||
csink->reset (sink);
|
||||
GST_DEBUG ("reset done");
|
||||
GST_DEBUG_OBJECT (sink, "reset done");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -476,15 +476,15 @@ gst_audioringbuffer_stop (GstRingBuffer * buf)
|
|||
|
||||
/* unblock any pending writes to the audio device */
|
||||
if (csink->reset) {
|
||||
GST_DEBUG ("reset...");
|
||||
GST_DEBUG_OBJECT (sink, "reset...");
|
||||
csink->reset (sink);
|
||||
GST_DEBUG ("reset done");
|
||||
GST_DEBUG_OBJECT (sink, "reset done");
|
||||
}
|
||||
|
||||
if (abuf->running) {
|
||||
GST_DEBUG ("stop, waiting...");
|
||||
GST_DEBUG_OBJECT (sink, "stop, waiting...");
|
||||
GST_AUDIORING_BUFFER_WAIT (buf);
|
||||
GST_DEBUG ("stopped");
|
||||
GST_DEBUG_OBJECT (sink, "stopped");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -559,9 +559,9 @@ gst_audio_sink_create_ringbuffer (GstBaseAudioSink * sink)
|
|||
{
|
||||
GstRingBuffer *buffer;
|
||||
|
||||
GST_DEBUG ("creating ringbuffer");
|
||||
GST_DEBUG_OBJECT (sink, "creating ringbuffer");
|
||||
buffer = g_object_new (GST_TYPE_AUDIORING_BUFFER, NULL);
|
||||
GST_DEBUG ("created ringbuffer @%p", buffer);
|
||||
GST_DEBUG_OBJECT (sink, "created ringbuffer @%p", buffer);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
@ -811,6 +811,9 @@ gst_ring_buffer_start (GstRingBuffer * buf)
|
|||
if (G_UNLIKELY (buf->abidata.ABI.flushing))
|
||||
goto flushing;
|
||||
|
||||
if (G_UNLIKELY (!buf->acquired))
|
||||
goto not_acquired;
|
||||
|
||||
/* if stopped, set to started */
|
||||
res = g_atomic_int_compare_and_exchange (&buf->state,
|
||||
GST_RING_BUFFER_STATE_STOPPED, GST_RING_BUFFER_STATE_STARTED);
|
||||
|
@ -852,6 +855,13 @@ done:
|
|||
|
||||
flushing:
|
||||
{
|
||||
GST_DEBUG_OBJECT (buf, "we are flushing");
|
||||
GST_OBJECT_UNLOCK (buf);
|
||||
return FALSE;
|
||||
}
|
||||
not_acquired:
|
||||
{
|
||||
GST_DEBUG_OBJECT (buf, "we are not acquired");
|
||||
GST_OBJECT_UNLOCK (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -918,6 +928,9 @@ gst_ring_buffer_pause (GstRingBuffer * buf)
|
|||
if (G_UNLIKELY (buf->abidata.ABI.flushing))
|
||||
goto flushing;
|
||||
|
||||
if (G_UNLIKELY (!buf->acquired))
|
||||
goto not_acquired;
|
||||
|
||||
res = gst_ring_buffer_pause_unlocked (buf);
|
||||
GST_OBJECT_UNLOCK (buf);
|
||||
|
||||
|
@ -926,6 +939,13 @@ gst_ring_buffer_pause (GstRingBuffer * buf)
|
|||
/* ERRORS */
|
||||
flushing:
|
||||
{
|
||||
GST_DEBUG_OBJECT (buf, "we are flushing");
|
||||
GST_OBJECT_UNLOCK (buf);
|
||||
return FALSE;
|
||||
}
|
||||
not_acquired:
|
||||
{
|
||||
GST_DEBUG_OBJECT (buf, "not acquired");
|
||||
GST_OBJECT_UNLOCK (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1011,18 +1031,23 @@ gst_ring_buffer_delay (GstRingBuffer * buf)
|
|||
|
||||
g_return_val_if_fail (GST_IS_RING_BUFFER (buf), 0);
|
||||
|
||||
res = 0;
|
||||
|
||||
/* buffer must be acquired */
|
||||
if (G_UNLIKELY (!gst_ring_buffer_is_acquired (buf)))
|
||||
goto done;
|
||||
goto not_acquired;
|
||||
|
||||
rclass = GST_RING_BUFFER_GET_CLASS (buf);
|
||||
if (G_LIKELY (rclass->delay))
|
||||
res = rclass->delay (buf);
|
||||
else
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
return res;
|
||||
|
||||
not_acquired:
|
||||
{
|
||||
GST_DEBUG_OBJECT (buf, "not acquired");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue