mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
ext/alsa/gstalsasink.c: Set handle to NULL.
Original commit message from CVS: * ext/alsa/gstalsasink.c: (gst_alsasink_init), (gst_alsasink_close): Set handle to NULL. * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_open_device), (gst_ring_buffer_close_device), (gst_ring_buffer_acquire), (gst_ring_buffer_release), (gst_ring_buffer_start), (gst_ring_buffer_pause), (gst_ring_buffer_stop), (gst_ring_buffer_commit), (gst_ring_buffer_read): More debug info.
This commit is contained in:
parent
456bd88950
commit
efb6fcb802
4 changed files with 67 additions and 2 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2005-10-18 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* ext/alsa/gstalsasink.c: (gst_alsasink_init),
|
||||
(gst_alsasink_close):
|
||||
Set handle to NULL.
|
||||
|
||||
* gst-libs/gst/audio/gstringbuffer.c:
|
||||
(gst_ring_buffer_open_device), (gst_ring_buffer_close_device),
|
||||
(gst_ring_buffer_acquire), (gst_ring_buffer_release),
|
||||
(gst_ring_buffer_start), (gst_ring_buffer_pause),
|
||||
(gst_ring_buffer_stop), (gst_ring_buffer_commit),
|
||||
(gst_ring_buffer_read):
|
||||
More debug info.
|
||||
|
||||
2005-10-17 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* gst/audiotestsrc/Makefile.am:
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit cf363b3ae6ce3c4a84a561e04ffc4e3b37435a61
|
||||
Subproject commit 1cb5d7b76a01c711674c752015089e70c394fa99
|
|
@ -238,6 +238,7 @@ gst_alsasink_init (GstAlsaSink * alsasink)
|
|||
GST_DEBUG ("initializing alsasink");
|
||||
|
||||
alsasink->device = g_strdup ("default");
|
||||
alsasink->handle = NULL;
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
|
@ -616,10 +617,20 @@ static gboolean
|
|||
gst_alsasink_close (GstAudioSink * asink)
|
||||
{
|
||||
GstAlsaSink *alsa = GST_ALSA_SINK (asink);
|
||||
gint err;
|
||||
|
||||
snd_pcm_close (alsa->handle);
|
||||
CHECK (snd_pcm_close (alsa->handle), close_error);
|
||||
alsa->handle = NULL;
|
||||
|
||||
return TRUE;
|
||||
|
||||
/* ERRORS */
|
||||
close_error:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, CLOSE,
|
||||
("Playback close error: %s", snd_strerror (err)), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -349,6 +349,8 @@ gst_ring_buffer_open_device (GstRingBuffer * buf)
|
|||
|
||||
g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (buf, "opening device");
|
||||
|
||||
GST_LOCK (buf);
|
||||
if (buf->open) {
|
||||
g_warning ("Device for ring buffer %p already open, fix your code", buf);
|
||||
|
@ -366,6 +368,9 @@ gst_ring_buffer_open_device (GstRingBuffer * buf)
|
|||
|
||||
if (!res) {
|
||||
buf->open = FALSE;
|
||||
GST_DEBUG_OBJECT (buf, "failed opening device");
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (buf, "opened device");
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -393,6 +398,8 @@ gst_ring_buffer_close_device (GstRingBuffer * buf)
|
|||
|
||||
g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (buf, "closing device");
|
||||
|
||||
GST_LOCK (buf);
|
||||
if (!buf->open) {
|
||||
g_warning ("Device for ring buffer %p already closed, fix your code", buf);
|
||||
|
@ -414,6 +421,9 @@ gst_ring_buffer_close_device (GstRingBuffer * buf)
|
|||
|
||||
if (!res) {
|
||||
buf->open = TRUE;
|
||||
GST_DEBUG_OBJECT (buf, "error closing device");
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (buf, "closed device");
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -470,6 +480,8 @@ gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
|||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (buf, "acquiring device");
|
||||
|
||||
GST_LOCK (buf);
|
||||
if (!buf->open) {
|
||||
g_critical ("Device for %p not opened", buf);
|
||||
|
@ -478,6 +490,7 @@ gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
|||
}
|
||||
if (buf->acquired) {
|
||||
res = TRUE;
|
||||
GST_DEBUG_OBJECT (buf, "device was acquired");
|
||||
goto done;
|
||||
}
|
||||
buf->acquired = TRUE;
|
||||
|
@ -488,6 +501,7 @@ gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
|||
|
||||
if (!res) {
|
||||
buf->acquired = FALSE;
|
||||
GST_DEBUG_OBJECT (buf, "failed to acquire device");
|
||||
} else {
|
||||
if (buf->spec.bytes_per_sample != 0) {
|
||||
gint i, j;
|
||||
|
@ -501,6 +515,7 @@ gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
|||
buf->empty_seg[i] = buf->spec.silence_sample[j];
|
||||
j = (j + 1) % buf->spec.bytes_per_sample;
|
||||
}
|
||||
GST_DEBUG_OBJECT (buf, "acquired device");
|
||||
} else {
|
||||
g_warning
|
||||
("invalid bytes_per_sample from acquire ringbuffer, fix the element");
|
||||
|
@ -532,11 +547,14 @@ gst_ring_buffer_release (GstRingBuffer * buf)
|
|||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (buf, "releasing device");
|
||||
|
||||
gst_ring_buffer_stop (buf);
|
||||
|
||||
GST_LOCK (buf);
|
||||
if (!buf->acquired) {
|
||||
res = TRUE;
|
||||
GST_DEBUG_OBJECT (buf, "device was released");
|
||||
goto done;
|
||||
}
|
||||
buf->acquired = FALSE;
|
||||
|
@ -553,9 +571,11 @@ gst_ring_buffer_release (GstRingBuffer * buf)
|
|||
|
||||
if (!res) {
|
||||
buf->acquired = TRUE;
|
||||
GST_DEBUG_OBJECT (buf, "failed to release device");
|
||||
} else {
|
||||
g_free (buf->empty_seg);
|
||||
buf->empty_seg = NULL;
|
||||
GST_DEBUG_OBJECT (buf, "released device");
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -608,6 +628,8 @@ gst_ring_buffer_start (GstRingBuffer * buf)
|
|||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (buf, "starting ringbuffer");
|
||||
|
||||
GST_LOCK (buf);
|
||||
/* if stopped, set to started */
|
||||
res = g_atomic_int_compare_and_exchange (&buf->state,
|
||||
|
@ -620,9 +642,11 @@ gst_ring_buffer_start (GstRingBuffer * buf)
|
|||
if (!res) {
|
||||
/* was not paused either, must be started then */
|
||||
res = TRUE;
|
||||
GST_DEBUG_OBJECT (buf, "was started");
|
||||
goto done;
|
||||
}
|
||||
resume = TRUE;
|
||||
GST_DEBUG_OBJECT (buf, "resuming");
|
||||
}
|
||||
|
||||
rclass = GST_RING_BUFFER_GET_CLASS (buf);
|
||||
|
@ -636,6 +660,9 @@ gst_ring_buffer_start (GstRingBuffer * buf)
|
|||
|
||||
if (!res) {
|
||||
buf->state = GST_RING_BUFFER_STATE_PAUSED;
|
||||
GST_DEBUG_OBJECT (buf, "failed to start");
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (buf, "started");
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -662,6 +689,8 @@ gst_ring_buffer_pause (GstRingBuffer * buf)
|
|||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (buf, "pausing ringbuffer");
|
||||
|
||||
GST_LOCK (buf);
|
||||
/* if started, set to paused */
|
||||
res = g_atomic_int_compare_and_exchange (&buf->state,
|
||||
|
@ -670,6 +699,7 @@ gst_ring_buffer_pause (GstRingBuffer * buf)
|
|||
if (!res) {
|
||||
/* was not started */
|
||||
res = TRUE;
|
||||
GST_DEBUG_OBJECT (buf, "was not started");
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -682,7 +712,11 @@ gst_ring_buffer_pause (GstRingBuffer * buf)
|
|||
|
||||
if (!res) {
|
||||
buf->state = GST_RING_BUFFER_STATE_STARTED;
|
||||
GST_DEBUG_OBJECT (buf, "failed to pause");
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (buf, "paused");
|
||||
}
|
||||
|
||||
done:
|
||||
GST_UNLOCK (buf);
|
||||
|
||||
|
@ -707,6 +741,8 @@ gst_ring_buffer_stop (GstRingBuffer * buf)
|
|||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (buf, "stopping");
|
||||
|
||||
GST_LOCK (buf);
|
||||
/* if started, set to stopped */
|
||||
res = g_atomic_int_compare_and_exchange (&buf->state,
|
||||
|
@ -714,6 +750,7 @@ gst_ring_buffer_stop (GstRingBuffer * buf)
|
|||
|
||||
if (!res) {
|
||||
/* was not started, must be stopped then */
|
||||
GST_DEBUG_OBJECT (buf, "was not started");
|
||||
res = TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
@ -727,6 +764,9 @@ gst_ring_buffer_stop (GstRingBuffer * buf)
|
|||
|
||||
if (!res) {
|
||||
buf->state = GST_RING_BUFFER_STATE_STARTED;
|
||||
GST_DEBUG_OBJECT (buf, "failed to stop");
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (buf, "stopped");
|
||||
}
|
||||
done:
|
||||
GST_UNLOCK (buf);
|
||||
|
|
Loading…
Reference in a new issue