- p_aout->mixer.p_module = module_need( p_aout, "audio mixer", NULL, 0 );
- if ( p_aout->mixer.p_module == NULL )
+ assert( !p_aout->p_mixer );
+ vlc_assert_locked( &p_aout->input_fifos_lock );
+
+ aout_mixer_t *p_mixer = vlc_object_create( p_aout, sizeof(*p_mixer) );
+ if( !p_mixer )
+ return VLC_EGENERIC;
+
+ p_mixer->fmt = p_aout->mixer_format;
+ p_mixer->allocation = p_aout->mixer_allocation;
+ p_mixer->multiplier = p_aout->mixer_multiplier;
+ p_mixer->input_count = p_aout->i_nb_inputs;
+ p_mixer->input = calloc( p_mixer->input_count, sizeof(*p_mixer->input) );
+ for( int i = 0; i < p_aout->i_nb_inputs; i++ )
+ p_mixer->input[i] = &p_aout->pp_inputs[i]->mixer;
+ p_mixer->mix = NULL;
+ p_mixer->sys = NULL;
+
+ vlc_object_attach( p_mixer, p_aout );
+
+ p_mixer->module = module_need( p_mixer, "audio mixer", NULL, false );
+ if( !p_mixer->module )