Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03893876 authored by Eric Laurent's avatar Eric Laurent
Browse files

audiopolicy: fix shared mmap capture

Change default maxActiveCount for MMAP input profiles to 0 (unlimited)
to enable simultaneaous capture by several streams in shared mmap mode.

Bug: 72134552
Test: 'adb shell write_sine_callback -m3 -pl -s100 -x' and Plug headphones in and out.
Test: AAudio CTS tests

Change-Id: I8743c2a8afb043c20babf8716878e5ca44bd72a4
parent 734046ea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public:
    void setGains(const AudioGainCollection &gains) { mGains = gains; }
    const AudioGainCollection &getGains() const { return mGains; }

    void setFlags(uint32_t flags)
    virtual void setFlags(uint32_t flags)
    {
        //force direct flag if offload flag is set: offloading implies a direct output stream
        // and all common behaviors are driven by checking only the direct flag
+14 −0
Original line number Diff line number Diff line
@@ -43,6 +43,20 @@ public:
    // For a Profile aka MixPort, tag name and name are equivalent.
    virtual const String8 getTagName() const { return getName(); }

    // FIXME: this is needed because shared MMAP stream clients use the same audio session.
    // Once capture clients are tracked individually and not per session this can be removed
    // MMAP no IRQ input streams do not have the default limitation of one active client
    // max as they can be used in shared mode by the same application.
    // NOTE: this works for explicit values set in audio_policy_configuration.xml because
    // flags are parsed before maxActiveCount by the serializer.
    void setFlags(uint32_t flags) override
    {
        AudioPort::setFlags(flags);
        if (getRole() == AUDIO_PORT_ROLE_SINK && (flags & AUDIO_INPUT_FLAG_MMAP_NOIRQ) != 0) {
            maxActiveCount = 0;
        }
    }

    // This method is used for input and direct output, and is not used for other output.
    // If parameter updatedSamplingRate is non-NULL, it is assigned the actual sample rate.
    // For input, flags is interpreted as audio_input_flags_t.