[vlc-commits] aout: always signal when the aout changed

Thomas Guillem git at videolan.org
Thu Sep 22 17:32:45 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep 22 16:36:59 2016 +0200| [4bba1e84a13a8d340b8a06df155bec8034bcd012] | committer: Thomas Guillem

aout: always signal when the aout changed

In a previous patch, we signaled that the aout changed when it was restarted.
We also need to signal that event when an aout module selects a device without
requesting a restart.

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

 src/audio_output/aout_internal.h | 1 +
 src/audio_output/dec.c           | 6 ++++++
 src/audio_output/output.c        | 1 +
 3 files changed, 8 insertions(+)

diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index c6edf8e..a0574fa 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -83,6 +83,7 @@ typedef struct
     atomic_uint buffers_lost;
     atomic_uint buffers_played;
     atomic_uchar restart;
+    bool device_changed;
 } aout_owner_t;
 
 typedef struct
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 1751e30..2f97848 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -83,6 +83,7 @@ int aout_DecNew( audio_output_t *p_aout,
     owner->input_format = *p_format;
     owner->mixer_format = owner->input_format;
     owner->request_vout = *p_request_vout;
+    owner->device_changed = false;
 
     if (aout_OutputNew (p_aout, &owner->mixer_format))
         goto error;
@@ -174,6 +175,11 @@ static int aout_CheckReady (audio_output_t *aout)
          * left over by an audio visualization:
         input_resource_TerminatVout(MAGIC HERE); */
     }
+    if (owner->device_changed)
+    {
+        owner->device_changed = false;
+        status = AOUT_DEC_CHANGED;
+    }
     return (owner->mixer_format.i_format) ? status : AOUT_DEC_FAILED;
 }
 
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 90db056..600705d 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -561,6 +561,7 @@ void aout_OutputUnlock (audio_output_t *aout)
         aout_OutputDeviceSet (aout, owner->req.device);
         free (owner->req.device);
         owner->req.device = (char *)unset_str;
+        owner->device_changed = true;
     }
 
     if (owner->req.volume >= 0.f)



More information about the vlc-commits mailing list