sink,source: Update sample rate if possible on stream uncork

If a stream is being uncorked and no other stream is running, we try to
update the sink/source sample rate to match it and avoid resampling.
This commit is contained in:
Arun Raghavan 2011-11-06 19:12:19 +05:30
parent 993d73d330
commit a813e85503
2 changed files with 12 additions and 0 deletions

View file

@ -515,6 +515,12 @@ static void source_output_set_state(pa_source_output *o, pa_source_output_state_
if (o->state == state)
return;
if (o->state == PA_SOURCE_OUTPUT_CORKED && state == PA_SOURCE_OUTPUT_RUNNING && pa_source_used_by(o->source) == 0) {
/* We were uncorked and the source was not playing anything -- let's try
* to update the sample rate to avoid resampling */
pa_source_update_rate(o->source, o->sample_spec.rate, pa_source_output_is_passthrough(o));
}
pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_SET_STATE, PA_UINT_TO_PTR(state), 0, NULL) == 0);
update_n_corked(o, state);