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

Commit 6d4b1593 authored by Eric Laurent's avatar Eric Laurent Committed by Automerger Merge Worker
Browse files

Merge "Refresh mixer behavior when the IOProfile is constructed from...

Merge "Refresh mixer behavior when the IOProfile is constructed from parcelable." into udc-qpr-dev am: 39184c44

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/24777888



Change-Id: I8d08f55f35028c137a8ae2663a141aa5fc3f5b81
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c058454a 39184c44
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -119,4 +119,15 @@ std::string dumpDeviceTypes(const DeviceTypeSet &deviceTypes) {
    return ss.str();
}

std::string dumpMixerBehaviors(const MixerBehaviorSet& mixerBehaviors) {
    std::stringstream ss;
    for (auto it = mixerBehaviors.begin(); it != mixerBehaviors.end(); ++it) {
        if (it != mixerBehaviors.begin()) {
            ss << ", ";
        }
        ss << (*it);
    }
    return ss.str();
}

} // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -126,6 +126,8 @@ bool deviceTypesToString(const DeviceTypeSet& deviceTypes, std::string &str);

std::string dumpDeviceTypes(const DeviceTypeSet& deviceTypes);

std::string dumpMixerBehaviors(const MixerBehaviorSet& mixerBehaviors);

/**
 * Return human readable string for device types.
 */
+5 −7
Original line number Diff line number Diff line
@@ -63,13 +63,7 @@ public:
        if (getRole() == AUDIO_PORT_ROLE_SINK && (flags & AUDIO_INPUT_FLAG_MMAP_NOIRQ) != 0) {
            maxActiveCount = 0;
        }
        if (getRole() == AUDIO_PORT_ROLE_SOURCE) {
            mMixerBehaviors.clear();
            mMixerBehaviors.insert(AUDIO_MIXER_BEHAVIOR_DEFAULT);
            if (mFlags.output & AUDIO_OUTPUT_FLAG_BIT_PERFECT) {
                mMixerBehaviors.insert(AUDIO_MIXER_BEHAVIOR_BIT_PERFECT);
            }
        }
        refreshMixerBehaviors();
    }

    const MixerBehaviorSet& getMixerBehaviors() const {
@@ -222,6 +216,8 @@ public:

    void toSupportedMixerAttributes(std::vector<audio_mixer_attributes_t>* mixerAttributes) const;

    status_t readFromParcelable(const media::AudioPortFw& parcelable);

    // Number of streams currently opened for this profile.
    uint32_t     curOpenCount;
    // Number of streams currently active for this profile. This is not the number of active clients
@@ -229,6 +225,8 @@ public:
    uint32_t     curActiveCount;

private:
    void refreshMixerBehaviors();

    DeviceVector mSupportedDevices; // supported devices: this input/output can be routed from/to

    MixerBehaviorSet mMixerBehaviors;
+22 −0
Original line number Diff line number Diff line
@@ -171,6 +171,24 @@ void IOProfile::toSupportedMixerAttributes(
    }
}

void IOProfile::refreshMixerBehaviors() {
    if (getRole() == AUDIO_PORT_ROLE_SOURCE) {
        mMixerBehaviors.clear();
        mMixerBehaviors.insert(AUDIO_MIXER_BEHAVIOR_DEFAULT);
        if (mFlags.output & AUDIO_OUTPUT_FLAG_BIT_PERFECT) {
            mMixerBehaviors.insert(AUDIO_MIXER_BEHAVIOR_BIT_PERFECT);
        }
    }
}

status_t IOProfile::readFromParcelable(const media::AudioPortFw &parcelable) {
    status_t status = AudioPort::readFromParcelable(parcelable);
    if (status == OK) {
        refreshMixerBehaviors();
    }
    return status;
}

void IOProfile::dump(String8 *dst, int spaces) const
{
    String8 extraInfo;
@@ -195,6 +213,10 @@ void IOProfile::dump(String8 *dst, int spaces) const
            spaces - 2, "", maxActiveCount, curActiveCount);
    dst->appendFormat("%*s- recommendedMuteDurationMs: %u ms\n",
            spaces - 2, "", recommendedMuteDurationMs);
    if (hasDynamicAudioProfile() && !mMixerBehaviors.empty()) {
        dst->appendFormat("%*s- mixerBehaviors: %s\n",
                spaces - 2, "", dumpMixerBehaviors(mMixerBehaviors).c_str());
    }
}

void IOProfile::log()