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

Commit a3d1098e authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4916303 from 46ba387b to pi-qpr1-release

Change-Id: Ib7f3ce69298dd640475eee3f450707a5197b9b0e
parents bb7f3c5e 46ba387b
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -860,7 +860,15 @@ static CodecBase *CreateCCodec() {
}

//static
sp<CodecBase> MediaCodec::GetCodecBase(const AString &name) {
sp<CodecBase> MediaCodec::GetCodecBase(const AString &name, const char *owner) {
    if (owner) {
        if (strncmp(owner, "default", 8) == 0) {
            return new ACodec;
        } else if (strncmp(owner, "codec2", 7) == 0) {
            return CreateCCodec();
        }
    }

    if (name.startsWithIgnoreCase("c2.")) {
        return CreateCCodec();
    } else if (name.startsWithIgnoreCase("omx.")) {
@@ -884,11 +892,6 @@ status_t MediaCodec::init(const AString &name) {
    // we need to invest in an extra looper to free the main event
    // queue.

    mCodec = GetCodecBase(name);
    if (mCodec == NULL) {
        return NAME_NOT_FOUND;
    }

    mCodecInfo.clear();

    bool secureCodec = false;
@@ -922,6 +925,11 @@ status_t MediaCodec::init(const AString &name) {
        return NAME_NOT_FOUND;
    }

    mCodec = GetCodecBase(name, mCodecInfo->getOwnerName());
    if (mCodec == NULL) {
        return NAME_NOT_FOUND;
    }

    if (mIsVideo) {
        // video codec needs dedicated looper
        if (mCodecLooper == NULL) {
@@ -1935,7 +1943,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                        mAnalyticsItem->setCString(kCodecCodec, mComponentName.c_str());
                    }

                    if (mComponentName.startsWith("OMX.google.")) {
                    const char *owner = mCodecInfo->getOwnerName();
                    if (mComponentName.startsWith("OMX.google.")
                            && (owner == nullptr || strncmp(owner, "default", 8) == 0)) {
                        mFlags |= kFlagUsesSoftwareRenderer;
                    } else {
                        mFlags &= ~kFlagUsesSoftwareRenderer;
+1 −1
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ private:

    MediaCodec(const sp<ALooper> &looper, pid_t pid, uid_t uid);

    static sp<CodecBase> GetCodecBase(const AString &name);
    static sp<CodecBase> GetCodecBase(const AString &name, const char *owner = nullptr);

    static status_t PostAndAwaitResponse(
            const sp<AMessage> &msg, sp<AMessage> *response);
+15 −5
Original line number Diff line number Diff line
@@ -861,6 +861,21 @@ status_t AudioPolicyManager::getOutputForAttr(const audio_attributes_t *attr,
        *flags = (audio_output_flags_t)(*flags | AUDIO_OUTPUT_FLAG_HW_AV_SYNC);
    }

    // Set incall music only if device was explicitly set, and fallback to the device which is
    // chosen by the engine if not.
    // FIXME: provide a more generic approach which is not device specific and move this back
    // to getOutputForDevice.
    if (device == AUDIO_DEVICE_OUT_TELEPHONY_TX &&
        *stream == AUDIO_STREAM_MUSIC &&
        audio_is_linear_pcm(config->format) &&
        isInCall()) {
        if (*selectedDeviceId != AUDIO_PORT_HANDLE_NONE) {
            *flags = (audio_output_flags_t)AUDIO_OUTPUT_FLAG_INCALL_MUSIC;
        } else {
            device = mEngine->getDeviceForStrategy(strategy);
        }
    }

    ALOGV("getOutputForAttr() device 0x%x, sampling rate %d, format %#x, channel mask %#x, "
          "flags %#x",
          device, config->sample_rate, config->format, config->channel_mask, *flags);
@@ -916,11 +931,6 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
        *flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_VOIP_RX |
                                       AUDIO_OUTPUT_FLAG_DIRECT);
        ALOGV("Set VoIP and Direct output flags for PCM format");
    } else if (device == AUDIO_DEVICE_OUT_TELEPHONY_TX &&
        stream == AUDIO_STREAM_MUSIC &&
        audio_is_linear_pcm(config->format) &&
        isInCall()) {
        *flags = (audio_output_flags_t)AUDIO_OUTPUT_FLAG_INCALL_MUSIC;
    }