[vlc-commits] PulseAudio: fix race when listing sinks

Rémi Denis-Courmont git at videolan.org
Wed Oct 31 21:59:48 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 31 22:52:25 2012 +0200| [62f9f6e8f2f09421227f13cc5e04ed077a9a5223] | committer: Rémi Denis-Courmont

PulseAudio: fix race when listing sinks

The stream might not exist.

Regression from e364643f52e6790cc8f177d6593d9a5c0c829513.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=62f9f6e8f2f09421227f13cc5e04ed077a9a5223
---

 modules/audio_output/pulse.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index da75f8b..1f9dff5 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -134,6 +134,7 @@ static void sink_list_cb(pa_context *c, const pa_sink_info *i, int eol,
                          void *userdata)
 {
     audio_output_t *aout = userdata;
+    aout_sys_t *sys = aout->sys;
     vlc_value_t val, text;
 
     if (eol)
@@ -150,8 +151,11 @@ static void sink_list_cb(pa_context *c, const pa_sink_info *i, int eol,
     /* FIXME: var_Change() can change the variable value if we remove the
      * current value from the choice list, or if we add a choice while there
      * was none. So force the correct value back. */
-    val.i_int = pa_stream_get_device_index(aout->sys->stream);
-    var_Change(aout, "audio-device", VLC_VAR_SETVALUE, &val, NULL);
+    if (sys->stream != NULL)
+    {
+        val.i_int = pa_stream_get_device_index(sys->stream);
+        var_Change(aout, "audio-device", VLC_VAR_SETVALUE, &val, NULL);
+    }
 }
 
 static void sink_info_cb(pa_context *c, const pa_sink_info *i, int eol,



More information about the vlc-commits mailing list