On 2025-02-11 7:04 a.m., Alexandre Ratchov wrote:
The sys->mute variable is not initialized, causing the volume
increase/decrease commants to possibly fail (depending on its initial
value).

The sys->volume is set by the VolumeChanged() call-back upon success
of the sio_onvol() call, but it's better style to initialize it as
well (in case sio_onvol() fails).

As we're at it, remove the extra aout_MuteReport() call added by the
previous commit.

OK?

OK.

Upstream questioned the diff and was looking for feedback.

https://code.videolan.org/videolan/vlc/-/merge_requests/6829


Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/vlc/Makefile,v
retrieving revision 1.279
diff -u -p -r1.279 Makefile
--- Makefile    7 Feb 2025 15:19:46 -0000       1.279
+++ Makefile    11 Feb 2025 11:57:46 -0000
@@ -9,7 +9,7 @@ CATEGORIES=     x11
  SITES=                https://download.videolan.org/pub/videolan/vlc/${V}/
  EXTRACT_SUFX= .tar.xz
  REVISION-jack=        0
-REVISION-main= 1
+REVISION-main= 2
USE_NOBTCFI= Yes Index: patches/patch-modules_audio_output_sndio_c
===================================================================
RCS file: /cvs/ports/x11/vlc/patches/patch-modules_audio_output_sndio_c,v
retrieving revision 1.7
diff -u -p -r1.7 patch-modules_audio_output_sndio_c
--- patches/patch-modules_audio_output_sndio_c  7 Feb 2025 15:19:46 -0000       
1.7
+++ patches/patch-modules_audio_output_sndio_c  11 Feb 2025 11:57:46 -0000
@@ -13,20 +13,29 @@ Index: modules/audio_output/sndio.c
       sys->started = 0;
       sys->delay = 0;
       sio_start (sys->hdl);
-@@ -276,6 +276,8 @@ static int VolumeSet (audio_output_t *aout, float fvol
+@@ -276,6 +276,7 @@ static int VolumeSet (audio_output_t *aout, float fvol
       if (!sys->mute && !sio_setvol (sys->hdl, volume))
           return -1;
       sys->volume = volume;
  +    aout_VolumeReport (aout, (float)sys->volume / SIO_MAXVOL);
-+    aout_MuteReport (aout, sys->volume == 0);
       return 0;
   }
-@@ -287,6 +289,7 @@ static int MuteSet (audio_output_t *aout, bool mute)
+@@ -287,6 +288,7 @@ static int MuteSet (audio_output_t *aout, bool mute)
           return -1;
sys->mute = mute;
  +    aout_MuteReport (aout, mute);
       return 0;
+ }
+
+@@ -300,7 +302,8 @@ static int Open (vlc_object_t *obj)
+     aout->sys = sys;
+     aout->start = Start;
+     aout->stop = Stop;
+-    /* FIXME: set volume/mute here */
++    sys->mute = 0;
++    sys->volume = SIO_MAXVOL;
+     return VLC_SUCCESS;
   }

Reply via email to