mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
sink-input: Allow sink_input_set_rate() to be called during a move
During a move sink_input->sink is not valid. This leads to a crash when sink_input_set_rate() is called from the moving() callback. This patch fixes the problem.
This commit is contained in:
parent
5bc363d4b8
commit
96cae04ced
1 changed files with 6 additions and 1 deletions
|
|
@ -1580,7 +1580,12 @@ int pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate) {
|
||||||
|
|
||||||
i->sample_spec.rate = rate;
|
i->sample_spec.rate = rate;
|
||||||
|
|
||||||
pa_asyncmsgq_post(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_RATE, PA_UINT_TO_PTR(rate), 0, NULL, NULL);
|
if (i->sink)
|
||||||
|
pa_asyncmsgq_post(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_RATE, PA_UINT_TO_PTR(rate), 0, NULL, NULL);
|
||||||
|
else {
|
||||||
|
i->thread_info.sample_spec.rate = rate;
|
||||||
|
pa_resampler_set_input_rate(i->thread_info.resampler, rate);
|
||||||
|
}
|
||||||
|
|
||||||
pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
|
pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue