X-Git-Url: https://code.delx.au/pulseaudio/blobdiff_plain/f41650a5507cf2b3a32fd39af06043ce0fdd50d9..fb70fa22c36f9220e8f4424948d0af476fb3d7a9:/src/pulsecore/source-output.c diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 7b08b7ef..4323bcf8 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -276,11 +276,6 @@ int pa_source_output_new( pa_source_output_new_data_set_source(data, source, false); } - pa_return_val_if_fail(PA_SOURCE_IS_LINKED(pa_source_get_state(data->source)), -PA_ERR_BADSTATE); - pa_return_val_if_fail(!data->direct_on_input || data->direct_on_input->sink == data->source->monitor_of, -PA_ERR_INVALID); - - /* Routing's done, we have a source. Now let's fix the format. */ - /* If something didn't pick a format for us, pick the top-most format since * we assume this is sorted in priority order */ if (!data->format && data->nego_formats && !pa_idxset_isempty(data->nego_formats)) @@ -299,6 +294,11 @@ int pa_source_output_new( return -PA_ERR_NOTSUPPORTED; } + pa_return_val_if_fail(PA_SOURCE_IS_LINKED(pa_source_get_state(data->source)), -PA_ERR_BADSTATE); + pa_return_val_if_fail(!data->direct_on_input || data->direct_on_input->sink == data->source->monitor_of, -PA_ERR_INVALID); + + /* Routing is done. We have a source and a format. */ + if (data->volume_is_set && pa_format_info_is_pcm(data->format)) { /* If volume is set, we need to save the original data->channel_map, * so that we can remap the volume from the original channel map to the @@ -1061,8 +1061,8 @@ void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save) { pa_assert_ctl_context(); pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); - if (!o->muted == !mute) { - o->save_muted = o->save_muted || mute; + if (mute == o->muted) { + o->save_muted |= save; return; } @@ -1263,6 +1263,7 @@ int pa_source_output_start_move(pa_source_output *o) { * their volume - this function does all that by using recursion. */ static void update_volume_due_to_moving(pa_source_output *o, pa_source *dest) { pa_cvolume old_volume; + pa_cvolume new_volume; pa_assert(o); pa_assert(dest); @@ -1336,25 +1337,21 @@ static void update_volume_due_to_moving(pa_source_output *o, pa_source *dest) { * (sources that use volume sharing should always have * soft_volume of 0 dB) */ - old_volume = o->destination_source->reference_volume; - - o->destination_source->reference_volume = root_source->reference_volume; - pa_cvolume_remap(&o->destination_source->reference_volume, &root_source->channel_map, &o->destination_source->channel_map); + new_volume = root_source->reference_volume; + pa_cvolume_remap(&new_volume, &root_source->channel_map, &o->destination_source->channel_map); + pa_source_set_reference_volume_direct(o->destination_source, &new_volume); o->destination_source->real_volume = root_source->real_volume; pa_cvolume_remap(&o->destination_source->real_volume, &root_source->channel_map, &o->destination_source->channel_map); pa_assert(pa_cvolume_is_norm(&o->destination_source->soft_volume)); - /* Notify others about the changed source volume. If you wonder whether - * o->destination_source->set_volume() should be called somewhere, that's not - * the case, because sources that use volume sharing shouldn't have any - * internal volume that set_volume() would update. If you wonder - * whether the thread_info variables should be synced, yes, they - * should, and it's done by the PA_SOURCE_MESSAGE_FINISH_MOVE message - * handler. */ - if (!pa_cvolume_equal(&o->destination_source->reference_volume, &old_volume)) - pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, o->destination_source->index); + /* If you wonder whether o->destination_source->set_volume() should be + * called somewhere, that's not the case, because sources that use + * volume sharing shouldn't have any internal volume that set_volume() + * would update. If you wonder whether the thread_info variables should + * be synced, yes, they should, and it's done by the + * PA_SOURCE_MESSAGE_FINISH_MOVE message handler. */ /* Recursively update origin source outputs. */ PA_IDXSET_FOREACH(destination_source_output, o->destination_source->outputs, idx) @@ -1656,7 +1653,8 @@ int pa_source_output_update_rate(pa_source_output *o) { o->requested_resample_method, ((o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) | ((o->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) | - (o->core->disable_remixing || (o->flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0)); + (o->core->disable_remixing || (o->flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) | + (o->core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)); if (!new_resampler) { pa_log_warn("Unsupported resampling operation.");