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

Commit 9b8c695c authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "audio policy: fix crash in findPreferredDevice() on duplicating outputs" into rvc-dev

parents 7feb854e 26874fed
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ public:
    virtual audio_patch_handle_t getPatchHandle() const = 0;

    virtual void setPatchHandle(audio_patch_handle_t handle) = 0;

    virtual bool isMmap() = 0;
};

template <class IoDescriptor, class Filter>
@@ -48,7 +50,7 @@ sp<DeviceDescriptor> findPreferredDevice(
        // created when the mmap stream is opened). This client is never active.
        // On non MMAP IOs, the preferred device is honored only if all active clients have
        // a preferred device in which case the first client drives the selection.
        if (desc->getPolicyAudioPort()->isMmap()) {
        if (desc->isMmap()) {
            // The client list is never empty on a MMAP IO
            return devices.getDeviceFromId(
                    desc->clientsList(false /*activeOnly*/)[0]->preferredDeviceId());
+6 −0
Original line number Diff line number Diff line
@@ -92,6 +92,12 @@ public:
    audio_config_base_t getConfig() const override;
    audio_patch_handle_t getPatchHandle() const override;
    void setPatchHandle(audio_patch_handle_t handle) override;
    bool isMmap() override {
        if (getPolicyAudioPort() != nullptr) {
            return getPolicyAudioPort()->isMmap();
        }
        return false;
    }

    status_t open(const audio_config_t *config,
                  const sp<DeviceDescriptor> &device,
+6 −0
Original line number Diff line number Diff line
@@ -268,6 +268,12 @@ public:
    audio_config_base_t getConfig() const override;
    audio_patch_handle_t getPatchHandle() const override;
    void setPatchHandle(audio_patch_handle_t handle) override;
    bool isMmap() override {
        if (getPolicyAudioPort() != nullptr) {
            return getPolicyAudioPort()->isMmap();
        }
        return false;
    }

    TrackClientVector clientsList(bool activeOnly = false,
                                  product_strategy_t strategy = PRODUCT_STRATEGY_NONE,