Commit 4dcd2503 authored by David Fuhrmann's avatar David Fuhrmann Committed by Jean-Baptiste Kempf

auhal: always set audio device callback

Previously, the audio device callback was only set when you call probe.
But in the case you reload the module (for example when switching from
encoded to unencoded output over the UI menu) probe was not called again.
This resulted in a crash when we want to delete the callback while closing.
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
(cherry picked from commit 0f62e1ad4efcaf72f2d99784c8a19a9b0dbea968)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent de75cf1d
...@@ -249,6 +249,9 @@ static int Open( vlc_object_t * p_this ) ...@@ -249,6 +249,9 @@ static int Open( vlc_object_t * p_this )
goto error; goto error;
} }
/* If we change the device we want to use, we should renegotiate the audio chain */
var_AddCallback( p_aout, "audio-device", AudioDeviceCallback, NULL );
/* Check for Digital mode or Analog output mode */ /* Check for Digital mode or Analog output mode */
if( AOUT_FMT_SPDIF( &p_aout->format ) && b_supports_digital ) if( AOUT_FMT_SPDIF( &p_aout->format ) && b_supports_digital )
{ {
...@@ -1033,9 +1036,6 @@ static void Probe( audio_output_t * p_aout ) ...@@ -1033,9 +1036,6 @@ static void Probe( audio_output_t * p_aout )
var_Set( p_aout, "audio-device", val ); var_Set( p_aout, "audio-device", val );
} }
/* If we change the device we want to use, we should renegotiate the audio chain */
var_AddCallback( p_aout, "audio-device", AudioDeviceCallback, NULL );
/* Attach a Listener so that we are notified of a change in the Device setup */ /* Attach a Listener so that we are notified of a change in the Device setup */
err = AudioObjectAddPropertyListener( kAudioObjectSystemObject, &audioDevicesAddress, HardwareListener, (void *)p_aout ); err = AudioObjectAddPropertyListener( kAudioObjectSystemObject, &audioDevicesAddress, HardwareListener, (void *)p_aout );
if( err ) if( err )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment