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

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

[AudioPolicy][engine][Strategy] fallback on music stream am: fd5779fa am:...

[AudioPolicy][engine][Strategy] fallback on music stream am: fd5779fa am: 8cd51311 am: 4e74c1b4

Change-Id: Ib88a023bc60a7330782ce29f84f50549b4baff64
parents 3791d108 4e74c1b4
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -73,10 +73,18 @@ bool ProductStrategy::matches(const audio_attributes_t attr) const
audio_stream_type_t ProductStrategy::getStreamTypeForAttributes(
        const audio_attributes_t &attr) const
{
    const auto iter = std::find_if(begin(mAttributesVector), end(mAttributesVector),
    const auto &iter = std::find_if(begin(mAttributesVector), end(mAttributesVector),
                                   [&attr](const auto &supportedAttr) {
        return AudioProductStrategy::attributesMatches(supportedAttr.mAttributes, attr); });
    return iter != end(mAttributesVector) ? iter->mStream : AUDIO_STREAM_DEFAULT;
    if (iter == end(mAttributesVector)) {
        return AUDIO_STREAM_DEFAULT;
    }
    audio_stream_type_t streamType = iter->mStream;
    ALOGW_IF(streamType == AUDIO_STREAM_DEFAULT,
             "%s: Strategy %s supporting attributes %s has not stream type associated"
             "fallback on MUSIC. Do not use stream volume API", __func__, mName.c_str(),
             toString(attr).c_str());
    return streamType != AUDIO_STREAM_DEFAULT ? streamType : AUDIO_STREAM_MUSIC;
}

audio_attributes_t ProductStrategy::getAttributesForStreamType(audio_stream_type_t streamType) const