[vlc-devel] [PATCH 1/2] auhal: reset au_unit in case of failure or when stopped

Thomas Guillem thomas at gllm.fr
Thu Apr 22 11:06:29 UTC 2021


---
 modules/audio_output/auhal.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index b2fce91b76e..c1960766241 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -1119,6 +1119,7 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
     return VLC_SUCCESS;
 error:
     AudioComponentInstanceDispose(p_sys->au_unit);
+    p_sys->au_unit = NULL;
     free(layout);
     return VLC_EGENERIC;
 }
@@ -1405,6 +1406,7 @@ Stop(audio_output_t *p_aout)
         AudioOutputUnitStop(p_sys->au_unit);
         au_Uninitialize(p_aout, p_sys->au_unit);
         AudioComponentInstanceDispose(p_sys->au_unit);
+        p_sys->au_unit = NULL;
     }
     else
     {
@@ -1492,8 +1494,6 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
         return VLC_EGENERIC;
 
     p_sys = p_aout->sys;
-    p_sys->b_digital = false;
-    p_sys->au_unit = NULL;
     p_sys->i_stream_index = -1;
     p_sys->b_revert = false;
     p_sys->b_changed_mixing = false;
@@ -1688,6 +1688,7 @@ static int Open(vlc_object_t *obj)
     vlc_mutex_init(&p_sys->device_list_lock);
     vlc_mutex_init(&p_sys->selected_device_lock);
     p_sys->b_digital = false;
+    p_sys->au_unit = NULL;
     p_sys->b_ignore_streams_changed_callback = false;
     p_sys->b_selected_dev_is_default = false;
     memset(&p_sys->sfmt_revert, 0, sizeof(p_sys->sfmt_revert));
-- 
2.30.0



More information about the vlc-devel mailing list