[gtk-vnc] Avoid crash with unsupported audio formats



commit c1b4fd07513707d2fe8e8144b6d019494c44ab39
Author: Daniel P. Berrange <berrange redhat com>
Date:   Thu Jan 31 10:40:29 2013 +0000

    Avoid crash with unsupported audio formats
    
    Currently if the VNC server sends an unsupported audio format,
    we skip creating the pulse audio instance. When we later receive
    audio data from QEMU we crash on this NULL instance. Instead we
    should simply discard the audio data. Also log a warning if we
    get a format we can't supported
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679283
    
    Signed-off-by: Daniel P. Berrange <berrange redhat com>

 src/vncaudiopulse.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/vncaudiopulse.c b/src/vncaudiopulse.c
index 0fb5232..abcc66b 100644
--- a/src/vncaudiopulse.c
+++ b/src/vncaudiopulse.c
@@ -65,6 +65,7 @@ static gboolean vnc_audio_pulse_playback_start(VncAudio *audio,
     case VNC_AUDIO_FORMAT_RAW_U16:
     case VNC_AUDIO_FORMAT_RAW_U32:
     default:
+        VNC_DEBUG("Unable to handle audio format %d", format->format);
         return FALSE;
     }
     pulse_spec.channels = format->nchannels;
@@ -104,6 +105,9 @@ static gboolean vnc_audio_pulse_playback_data(VncAudio *audio,
     VncAudioPulse *pulse = VNC_AUDIO_PULSE(audio);
     VncAudioPulsePrivate *priv = pulse->priv;
 
+    if (!priv->pa)
+        return FALSE;
+
     if (pa_simple_write(priv->pa, sample->data, sample->length, NULL) < 0)
         return FALSE;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]