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

Tristan Matthews git at videolan.org
Fri Mar 27 13:37:10 CET 2020


vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Thu Mar 26 11:04:48 2020 -0400| [84412e37928d4bcce40026f19369581564e327a3] | committer: Tristan Matthews

audio_output: ensure callbacks are set before calling

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

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

 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;
 }



More information about the vlc-commits mailing list