[vlc-devel] [PATCH] audio_output: ensure callbacks are set before calling

Tristan Matthews tmatth at videolan.org
Thu Mar 26 16:45:32 CET 2020


This fixes a crash when changing the volume while using the file aout module.

Regression from:

commit 8fb81d08d6500136d467a46c4796c0872d7705cd
Author: RĂ©mi Denis-Courmont <remi at remlab.net>
Date:   Sat May 5 13:06:19 2018 +0300

    aout: inline some functions
---
 src/audio_output/output.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 472acc968f..99fa946f14 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -653,7 +653,7 @@ int aout_VolumeSet (audio_output_t *aout, float vol)
     int ret;
 
     vlc_mutex_lock(&owner->lock);
-    ret = aout->volume_set(aout, vol);
+    ret = aout->volume_set ? aout->volume_set(aout, vol) : -1;
     vlc_mutex_unlock(&owner->lock);
     return ret ? -1 : 0;
 }
@@ -704,7 +704,7 @@ int aout_MuteSet (audio_output_t *aout, bool mute)
     int ret;
 
     vlc_mutex_lock(&owner->lock);
-    ret = aout->mute_set(aout, mute);
+    ret = aout->mute_set ? aout->mute_set(aout, mute) : -1;
     vlc_mutex_unlock(&owner->lock);
     return ret ? -1 : 0;
 }
@@ -730,7 +730,7 @@ int aout_DeviceSet (audio_output_t *aout, const char *id)
     int ret;
 
     vlc_mutex_lock(&owner->lock);
-    ret = aout->device_select(aout, id);
+    ret = aout->device_select ? aout->device_select(aout, id) : -1;
     vlc_mutex_unlock(&owner->lock);
     return ret ? -1 : 0;
 }
-- 
2.20.1



More information about the vlc-devel mailing list