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

Commit a7b0b4e9 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "audiopolicy: apm: factorize internal patch creation/release" am: 7505ec7c am: 9e850005

Change-Id: I2dce8a1deb5722ebf55b2ff1ded23e62e9c948e5
parents 190ef64d 9e850005
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -31,12 +31,24 @@ class AudioPatch : public RefBase, private HandleGenerator<audio_patch_handle_t>
public:
    AudioPatch(const struct audio_patch *patch, uid_t uid);

    audio_patch_handle_t getHandle() const { return mHandle; }

    audio_patch_handle_t getAfHandle() const { return mAfPatchHandle; }

    void setAfHandle(audio_patch_handle_t afHandle) { mAfPatchHandle = afHandle; }

    uid_t getUid() const { return mUid; }

    void setUid(uid_t uid) { mUid = uid; }

    void dump(String8 *dst, int spaces, int index) const;

    audio_patch_handle_t mHandle;
    struct audio_patch mPatch;

private:
    const audio_patch_handle_t mHandle;
    uid_t mUid;
    audio_patch_handle_t mAfPatchHandle;
    audio_patch_handle_t mAfPatchHandle = AUDIO_PATCH_HANDLE_NONE;
};

class AudioPatchCollection : public DefaultKeyedVector<audio_patch_handle_t, sp<AudioPatch> >
+8 −4
Original line number Diff line number Diff line
@@ -183,13 +183,17 @@ class SourceClientDescriptor: public TrackClientDescriptor
{
public:
    SourceClientDescriptor(audio_port_handle_t portId, uid_t uid, audio_attributes_t attributes,
                           const sp<AudioPatch>& patchDesc, const sp<DeviceDescriptor>& srcDevice,
                           const struct audio_port_config &config,
                           const sp<DeviceDescriptor>& srcDevice,
                           audio_stream_type_t stream, product_strategy_t strategy,
                           VolumeSource volumeSource);

    ~SourceClientDescriptor() override = default;

    sp<AudioPatch> patchDesc() const { return mPatchDesc; }
    sp<DeviceDescriptor> srcDevice() const { return mSrcDevice; };
    audio_patch_handle_t getPatchHandle() const { return mPatchHandle; }
    void setPatchHandle(audio_patch_handle_t patchHandle) { mPatchHandle = patchHandle; }

    sp<DeviceDescriptor> srcDevice() const { return mSrcDevice; }
    wp<SwAudioOutputDescriptor> swOutput() const { return mSwOutput; }
    void setSwOutput(const sp<SwAudioOutputDescriptor>& swOutput);
    wp<HwAudioOutputDescriptor> hwOutput() const { return mHwOutput; }
@@ -199,7 +203,7 @@ public:
    void dump(String8 *dst, int spaces, int index) const override;

 private:
    const sp<AudioPatch> mPatchDesc;
    audio_patch_handle_t mPatchHandle = AUDIO_PATCH_HANDLE_NONE;
    const sp<DeviceDescriptor> mSrcDevice;
    wp<SwAudioOutputDescriptor> mSwOutput;
    wp<HwAudioOutputDescriptor> mHwOutput;
+5 −6
Original line number Diff line number Diff line
@@ -26,10 +26,9 @@
namespace android {

AudioPatch::AudioPatch(const struct audio_patch *patch, uid_t uid) :
    mHandle(HandleGenerator<audio_patch_handle_t>::getNextHandle()),
    mPatch(*patch),
    mUid(uid),
    mAfPatchHandle(AUDIO_PATCH_HANDLE_NONE)
    mHandle(HandleGenerator<audio_patch_handle_t>::getNextHandle()),
    mUid(uid)
{
}

@@ -68,7 +67,7 @@ status_t AudioPatchCollection::addAudioPatch(audio_patch_handle_t handle,
    add(handle, patch);
    ALOGV("addAudioPatch() handle %d af handle %d num_sources %d num_sinks %d source handle %d"
            "sink handle %d",
          handle, patch->mAfPatchHandle, patch->mPatch.num_sources, patch->mPatch.num_sinks,
          handle, patch->getAfHandle(), patch->mPatch.num_sources, patch->mPatch.num_sinks,
          patch->mPatch.sources[0].id, patch->mPatch.sinks[0].id);
    return NO_ERROR;
}
@@ -81,7 +80,7 @@ status_t AudioPatchCollection::removeAudioPatch(audio_patch_handle_t handle)
        ALOGW("removeAudioPatch() patch %d not in", handle);
        return ALREADY_EXISTS;
    }
    ALOGV("removeAudioPatch() handle %d af handle %d", handle, valueAt(index)->mAfPatchHandle);
    ALOGV("removeAudioPatch() handle %d af handle %d", handle, valueAt(index)->getAfHandle());
    removeItemsAt(index);
    return NO_ERROR;
}
@@ -123,7 +122,7 @@ status_t AudioPatchCollection::listAudioPatches(unsigned int *num_patches,
        }
        if (patchesWritten < patchesMax) {
            patches[patchesWritten] = patch->mPatch;
            patches[patchesWritten++].id = patch->mHandle;
            patches[patchesWritten++].id = patch->getHandle();
        }
        (*num_patches)++;
        ALOGV("listAudioPatches() patch %zu num_sources %d num_sinks %d",
+3 −4
Original line number Diff line number Diff line
@@ -82,14 +82,13 @@ void RecordClientDescriptor::dump(String8 *dst, int spaces, int index) const
}

SourceClientDescriptor::SourceClientDescriptor(audio_port_handle_t portId, uid_t uid,
         audio_attributes_t attributes, const sp<AudioPatch>& patchDesc,
         audio_attributes_t attributes, const struct audio_port_config &config,
         const sp<DeviceDescriptor>& srcDevice, audio_stream_type_t stream,
         product_strategy_t strategy, VolumeSource volumeSource) :
    TrackClientDescriptor::TrackClientDescriptor(portId, uid, AUDIO_SESSION_NONE, attributes,
        AUDIO_CONFIG_BASE_INITIALIZER, AUDIO_PORT_HANDLE_NONE,
        {config.sample_rate, config.channel_mask, config.format}, AUDIO_PORT_HANDLE_NONE,
        stream, strategy, volumeSource, AUDIO_OUTPUT_FLAG_NONE, false,
        {} /* Sources do not support secondary outputs*/),
        mPatchDesc(patchDesc), mSrcDevice(srcDevice)
        {} /* Sources do not support secondary outputs*/), mSrcDevice(srcDevice)
{
}

+204 −223

File changed.

Preview size limit exceeded, changes collapsed.

Loading