thaytan gst-plugins-good: gst-plugins-good/ gst-plugins-good/ext/pulse/
[email protected] Wed, 7 Jan 2009 12:39:05 -0800 (PST)
| Newsgroups | gmane.comp.video.gstreamer.cvs |
|---|---|
| Message-ID | <[email protected]> |
CVS Root: /cvs/gstreamer
Module: gst-plugins-good
Changes by: thaytan
Date: Wed Jan 07 2009 20:39:05 UTC
Log message:
* ext/pulse/pulsesink.c:
* ext/pulse/pulsesink.h:
Use a mutex to protect the current stream pointer, and ignore
callbacks for stream objects that have been destroyed already.
Fixes problems with unprepare/prepare cycles caused by the input
caps changing, without reintroducing bug #556986.
Modified files:
. : ChangeLog
ext/pulse : pulsesink.c pulsesink.h
Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.3887&r2=1.3888
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ext/pulse/pulsesink.c.diff?r1=1.12&r2=1.13
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ext/pulse/pulsesink.h.diff?r1=1.3&r2=1.4
====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v
retrieving revision 1.3887
retrieving revision 1.3888
diff -u -d -r1.3887 -r1.3888
--- ChangeLog 7 Jan 2009 16:09:46 -0000 1.3887
+++ ChangeLog 7 Jan 2009 20:38:49 -0000 1.3888
@@ -1,5 +1,14 @@
2009-01-07 Jan Schmidt <[email protected]>
+ * ext/pulse/pulsesink.c:
+ * ext/pulse/pulsesink.h:
+ Use a mutex to protect the current stream pointer, and ignore
+ callbacks for stream objects that have been destroyed already.
+ Fixes problems with unprepare/prepare cycles caused by the input
+ caps changing, without reintroducing bug #556986.
+
+2009-01-07 Jan Schmidt <[email protected]>
* sys/v4l2/gstv4l2src.c:
Remove () from translateable string, so that it makes more sense.
Index: pulsesink.c
RCS file: /cvs/gstreamer/gst-plugins-good/ext/pulse/pulsesink.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pulsesink.c 5 Jan 2009 17:31:13 -0000 1.12
+++ pulsesink.c 7 Jan 2009 20:38:50 -0000 1.13
@@ -264,6 +264,8 @@
pulsesink->context = NULL;
pulsesink->stream = NULL;
+ pulsesink->stream_mutex = g_mutex_new ();
pulsesink->mainloop = pa_threaded_mainloop_new ();
g_assert (pulsesink->mainloop);
@@ -277,11 +279,13 @@
static void
gst_pulsesink_destroy_stream (GstPulseSink * pulsesink)
{
+ g_mutex_lock (pulsesink->stream_mutex);
if (pulsesink->stream) {
pa_stream_disconnect (pulsesink->stream);
pa_stream_unref (pulsesink->stream);
pulsesink->stream = NULL;
}
+ g_mutex_unlock (pulsesink->stream_mutex);
g_free (pulsesink->stream_name);
pulsesink->stream_name = NULL;
@@ -290,7 +294,6 @@
gst_pulsesink_destroy_context (GstPulseSink * pulsesink)
-
gst_pulsesink_destroy_stream (pulsesink);
if (pulsesink->context) {
@@ -313,6 +316,8 @@
g_free (pulsesink->device);
+ g_mutex_free (pulsesink->stream_mutex);
pa_threaded_mainloop_free (pulsesink->mainloop);
if (pulsesink->probe) {
@@ -482,8 +487,16 @@
case PA_STREAM_READY:
case PA_STREAM_FAILED:
- case PA_STREAM_TERMINATED:
- pa_threaded_mainloop_signal (pulsesink->mainloop, 0);
+ case PA_STREAM_TERMINATED:{
+ pa_stream *cur_stream;
+ g_mutex_lock (pulsesink->stream_mutex);
+ cur_stream = pulsesink->stream;
+ g_mutex_unlock (pulsesink->stream_mutex);
+ if (cur_stream == s)
+ pa_threaded_mainloop_signal (pulsesink->mainloop, 0);
+ }
break;
case PA_STREAM_UNCONNECTED:
@@ -496,16 +509,28 @@
gst_pulsesink_stream_request_cb (pa_stream * s, size_t length, void *userdata)
GstPulseSink *pulsesink = GST_PULSESINK (userdata);
+ pa_stream *cur_stream;
- pa_threaded_mainloop_signal (pulsesink->mainloop, 0);
+ cur_stream = pulsesink->stream;
+ if (cur_stream == s)
+ pa_threaded_mainloop_signal (pulsesink->mainloop, 0);
}
gst_pulsesink_stream_latency_update_cb (pa_stream * s, void *userdata)
static gboolean
@@ -592,15 +617,18 @@
goto unlock_and_fail;
if (!(pulsesink->stream = pa_stream_new (pulsesink->context,
pulsesink->stream_name ? pulsesink->
stream_name : "Playback Stream", &pulsesink->sample_spec,
gst_pulse_gst_to_channel_map (&channel_map, spec)))) {
+ g_mutex_unlock (pulsesink->stream_mutex);
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED,
("Failed to create stream: %s",
pa_strerror (pa_context_errno (pulsesink->context))), (NULL));
pa_stream_set_state_callback (pulsesink->stream,
gst_pulsesink_stream_state_cb, pulsesink);
Index: pulsesink.h
RCS file: /cvs/gstreamer/gst-plugins-good/ext/pulse/pulsesink.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pulsesink.h 13 Aug 2008 13:57:01 -0000 1.3
+++ pulsesink.h 7 Jan 2009 20:38:50 -0000 1.4
@@ -57,6 +57,7 @@
pa_context *context;
pa_stream *stream;
+ GMutex *stream_mutex;
pa_sample_spec sample_spec;
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB