From 4b5472b100ae2fd3a0aa4649099888388c869848 Mon Sep 17 00:00:00 2001 From: Marcelo Fernandez Date: Wed, 11 Apr 2018 11:46:58 -0300 Subject: [PATCH] Fix error detecting for PulseAudio pa_stream_new call (cherry picked from commit 86e101ec823e916080cb113031ff04edbe3757c6) --- drivers/pulseaudio/audio_driver_pulseaudio.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index ad1b241dbac..fac73da44d5 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -178,7 +178,10 @@ Error AudioDriverPulseAudio::init_device() { attr.minreq = (uint32_t)-1; pa_str = pa_stream_new(pa_ctx, "Sound", &spec, NULL); - ERR_FAIL_COND_V(pa_ctx == NULL, ERR_CANT_OPEN); + if (pa_str == NULL) { + ERR_PRINTS("PulseAudio: pa_stream_new error: " + String(pa_strerror(pa_context_errno(pa_ctx)))); + ERR_FAIL_V(ERR_CANT_OPEN); + } const char *dev = device_name == "Default" ? NULL : device_name.utf8().get_data(); pa_stream_flags flags = pa_stream_flags(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE);