+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:
/* 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;
}
}
could_not_open:
{
- GST_DEBUG ("could not open device");
+ GST_DEBUG_OBJECT (sink, "could not open device");
return FALSE;
}
}
could_not_close:
{
- GST_DEBUG ("could not close device");
+ GST_DEBUG_OBJECT (sink, "could not close device");
return FALSE;
}
}
could_not_prepare:
{
- GST_DEBUG ("could not prepare device");
+ GST_DEBUG_OBJECT (sink, "could not prepare device");
return FALSE;
}
}
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);
could_not_unprepare:
{
- GST_DEBUG ("could not unprepare device");
+ GST_DEBUG_OBJECT (sink, "could not unprepare device");
return FALSE;
}
}
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;
/* 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;
/* 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;
{
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;
}
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);
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;
}
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);
/* 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;
}
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;
+ }
}
/**