From 8d6ca0625745d1f955af909708dcf43993c6a48a Mon Sep 17 00:00:00 2001 From: Grishka Date: Tue, 31 Oct 2017 11:19:00 +0300 Subject: [PATCH] Correctly handle ALSA errors (actually, it should have been like this from the beginning) telegramdesktop/tdesktop#3412 --- os/linux/AudioInputALSA.cpp | 2 +- os/linux/AudioOutputALSA.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/os/linux/AudioInputALSA.cpp b/os/linux/AudioInputALSA.cpp index 177474d..c6cd530 100644 --- a/os/linux/AudioInputALSA.cpp +++ b/os/linux/AudioInputALSA.cpp @@ -15,7 +15,7 @@ using namespace tgvoip::audio; #define BUFFER_SIZE 960 -#define CHECK_ERROR(res, msg) if(res<0){LOGE(msg ": %s", _snd_strerror(res));} +#define CHECK_ERROR(res, msg) if(res<0){LOGE(msg ": %s", _snd_strerror(res)); failed=true; return;} #define CHECK_DL_ERROR(res, msg) if(!res){LOGE(msg ": %s", dlerror()); failed=true; return;} #define LOAD_FUNCTION(lib, name, ref) {ref=(typeof(ref))dlsym(lib, name); CHECK_DL_ERROR(ref, "Error getting entry point for " name);} diff --git a/os/linux/AudioOutputALSA.cpp b/os/linux/AudioOutputALSA.cpp index 593edca..378970b 100644 --- a/os/linux/AudioOutputALSA.cpp +++ b/os/linux/AudioOutputALSA.cpp @@ -12,7 +12,7 @@ #include "../../VoIPController.h" #define BUFFER_SIZE 960 -#define CHECK_ERROR(res, msg) if(res<0){LOGE(msg ": %s", _snd_strerror(res));} +#define CHECK_ERROR(res, msg) if(res<0){LOGE(msg ": %s", _snd_strerror(res)); failed=true; return;} #define CHECK_DL_ERROR(res, msg) if(!res){LOGE(msg ": %s", dlerror()); failed=true; return;} #define LOAD_FUNCTION(lib, name, ref) {ref=(typeof(ref))dlsym(lib, name); CHECK_DL_ERROR(ref, "Error getting entry point for " name);}