[pulseaudio-discuss] [PATCH v2 3/5] replace sink/source SET_STATE handlers with callbacks
Tanu Kaskinen
tanuk at iki.fi
Wed Mar 14 19:12:02 UTC 2018
On Wed, 2018-03-14 at 01:23 +0300, Raman Shyshniou wrote:
> Hello,
>
> 13.03.2018 20:40, Tanu Kaskinen пишет:
> > diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
>
> ...
> > +/* Called from the IO thread. */
> > +static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state) {
>
> ...
> > + switch (new_state) {
> > +
> > + case PA_SINK_SUSPENDED: {
> > + pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state));
>
> ...
> > diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
>
> ...
> > +/* Called from the IO thread. */
> > +static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_state) {
>
> ...
> > + switch (new_state) {
> > +
> > + case PA_SOURCE_SUSPENDED: {
> > + pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state));
>
> ...
> > diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c
>
> ...
> > + case PA_SINK_SUSPENDED:
> > + /* Ignore if transition is PA_SINK_INIT->PA_SINK_SUSPENDED */
> > + if (!PA_SINK_IS_OPENED(u->sink->thread_info.state))
> > + break;
>
> ...
> > + case PA_SOURCE_SUSPENDED:
> > + /* Ignore if transition is PA_SOURCE_INIT->PA_SOURCE_SUSPENDED */
> > + if (!PA_SOURCE_IS_OPENED(u->source->thread_info.state))
> > + break;
>
> I know this is only code movement from SET_STATE handler to callbacks.
> But looking in alsa sink/source these transitions are impossible:
> PA_SINK_INIT->PA_SINK_SUSPENDED
> PA_SOURCE_INIT->PA_SOURCE_SUSPENDED
Those transitions are possible in the bluetooth modules, because in
certain situations they create the sink and source in suspended state.
The alsa sink and source never do that, so for them the transition is
impossible.
--
Tanu
https://liberapay.com/tanuk
https://www.patreon.com/tanuk
More information about the pulseaudio-discuss
mailing list