[pulseaudio-discuss] [RFC PATCH 1/2] pulsecore: sink: force suspend/resume on passthrough transitions

Tanu Kaskinen tanuk at iki.fi
Sun Sep 3 10:57:06 UTC 2017

On Sun, 2017-09-03 at 11:32 +0530, Arun Raghavan wrote:
> On Tue, 29 Aug 2017, at 04:19 AM, Pierre-Louis Bossart wrote:
> > A race condition prevents the AES non-audio bit from being set
> > when enabling IEC61937 passthrough on resume with no sink-input
> > connected (pa_sink_is_passthrough returns false). The non-audio
> > bit should really be set when opening the sink.
> > 
> > Force the sink to suspend/resume when actually entering passthrough
> > mode, and likewise force a suspend-resume on leaving passthrough mode.
> > 
> > Tested with E-AC3 streams which do need the AES bit set for my
> > Onkyon receiver to detect the format instead of playing it as
> > PCM.
> > 
> > Signed-off-by: Pierre-Louis Bossart
> > <pierre-louis.bossart at linux.intel.com>
> > ---
> Looks good. Pushed to next.

I propose reverting this. In the off-list discussion we've been having,
I raised a concern regarding the approach used here. I'll copy the
relevant text here:

    Reopening the device again in pa_sink_enter_passthrough() like you
    do in your patch may seem like a simple workaround, but it's only
    simple because you're ignoring the case where pa_sink_suspend()
    fails. I would guess that suspending can never fail (I didn't
    check), but unsuspending definitely can. I don't think it's a good
    idea to ignore failures, but not ignoring the failure also means
    that pa_sink_input_put() should fail, and currently that function
    can't fail, and changing that is not simple.

The bug about setting the AES bit can be fixed by moving the
pa_sink_update_rate() to happen a bit later, after the sink input has
been added to pa_sink.inputs. As we discussed, pa_sink_input_rate()
will then have to be called every time when entering or leaving the
passthrough mode, even when the sink rate doesn't have to be changed.



More information about the pulseaudio-discuss mailing list