Commit 1d7c5598 authored by Thomas Guillem's avatar Thomas Guillem

libvlc_media_player: create the aout when first setting audio options

If not setting any audio options, the aout will be created by the decoder
thread.

This avoids to create an audio output that will be destroyed if you change it
with libvlc_audio_output_set.
parent 13404416
......@@ -51,7 +51,17 @@ static audio_output_t *GetAOut( libvlc_media_player_t *mp )
audio_output_t *p_aout = input_resource_HoldAout( mp->input.p_resource );
if( p_aout == NULL )
{
p_aout = input_resource_GetAout( mp->input.p_resource );
if( p_aout != NULL )
{
input_resource_PutAout( mp->input.p_resource, p_aout );
p_aout = input_resource_HoldAout( mp->input.p_resource );
}
else
libvlc_printerr( "No active audio output" );
}
return p_aout;
}
......@@ -133,11 +143,6 @@ int libvlc_audio_output_set( libvlc_media_player_t *mp, const char *psz_name )
/* Forget the existing audio output */
input_resource_ResetAout(mp->input.p_resource);
/* Create a new audio output */
audio_output_t *aout = input_resource_GetAout(mp->input.p_resource);
if( aout != NULL )
input_resource_PutAout(mp->input.p_resource, aout);
return 0;
}
......
......@@ -595,10 +595,6 @@ libvlc_media_player_new( libvlc_instance_t *instance )
vlc_object_release(mp);
return NULL;
}
audio_output_t *aout = input_resource_GetAout(mp->input.p_resource);
if( aout != NULL )
input_resource_PutAout(mp->input.p_resource, aout);
vlc_mutex_init (&mp->input.lock);
mp->i_refcount = 1;
mp->p_event_manager = libvlc_event_manager_new(mp, instance);
......
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