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

Commit 01e2b050 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12235414 from 2e961e91 to 24Q4-release

Change-Id: Ibea8bcb022cbf87d8e07818c18536ad4ab3f7330
parents 2d740ce4 2e961e91
Loading
Loading
Loading
Loading
+23 −3
Original line number Diff line number Diff line
@@ -139,6 +139,20 @@ class Codec2VideoDecHidlTestBase : public ::testing::Test {
        mReorderDepth = -1;
        mTimestampDevTest = false;
        mMd5Offset = 0;
        mIsTunneledCodec = false;

        // For C2 codecs that support tunneling by default, the default value of
        // C2PortTunneledModeTuning::mode should (!= NONE). Otherwise VTS
        // can assume that the codec can support regular (non-tunneled decode)
        queried.clear();
        c2err = mComponent->query(
                {}, {C2PortTunneledModeTuning::output::PARAM_TYPE}, C2_MAY_BLOCK, &queried);
        if (c2err == C2_OK && !queried.empty() && queried.front() != nullptr) {
            C2TunneledModeStruct::mode_t tunneledMode =
                    ((C2PortTunneledModeTuning::output*)queried.front().get())->m.mode;
            mIsTunneledCodec = (tunneledMode != C2TunneledModeStruct::NONE);
        }

        mMd5Enable = false;
        mRefMd5 = nullptr;

@@ -308,6 +322,7 @@ class Codec2VideoDecHidlTestBase : public ::testing::Test {

    bool mEos;
    bool mDisableTest;
    bool mIsTunneledCodec;
    bool mMd5Enable;
    bool mTimestampDevTest;
    uint64_t mTimestampUs;
@@ -612,11 +627,14 @@ TEST_P(Codec2VideoDecDecodeTest, DecodeTest) {

    bool signalEOS = std::get<3>(GetParam());
    surfaceMode_t surfMode = std::get<4>(GetParam());
    mTimestampDevTest = true;
    // Disable checking timestamp as tunneled codecs doesn't populate
    // output buffers in C2Work.
    mTimestampDevTest = !mIsTunneledCodec;

    android::Vector<FrameInfo> Info;

    mMd5Enable = true;
    // Disable md5 checks as tunneled codecs doesn't populate output buffers in C2Work
    mMd5Enable = !mIsTunneledCodec;
    if (!mChksumFile.compare(sResourceDir)) mMd5Enable = false;

    uint32_t format = HAL_PIXEL_FORMAT_YCBCR_420_888;
@@ -712,7 +730,9 @@ TEST_P(Codec2VideoDecHidlTest, AdaptiveDecodeTest) {
    typedef std::unique_lock<std::mutex> ULock;
    ASSERT_EQ(mComponent->start(), C2_OK);

    mTimestampDevTest = true;
    // Disable checking timestamp as tunneled codecs doesn't populate
    // output buffers in C2Work.
    mTimestampDevTest = !mIsTunneledCodec;
    uint32_t timestampOffset = 0;
    uint32_t offset = 0;
    android::Vector<FrameInfo> Info;
+1 −8
Original line number Diff line number Diff line
@@ -34,17 +34,9 @@ cc_defaults {
    ],
    shared_libs: [
        "android.hardware.audio.common-util",
        "av-types-aidl-cpp",
        "effect-aidl-cpp",
        "libaudioflinger",
        "libaudiomanager",
        "libaudiopolicyservice",
        "libaudioprocessing",
        "libdl",
        "libnbaio",
        "libnblog",
        "libpowermanager",
        "libvibrator",
        "libvndksupport",
        "mediametricsservice-aidl-cpp",
    ],
@@ -74,6 +66,7 @@ cc_fuzz {
        "latest_android_hardware_audio_core_sounddose_ndk_shared",
        "latest_android_hardware_audio_effect_ndk_shared",
        "libaudioclient_aidl_fuzzer_defaults",
        "libaudioflinger_dependencies",
        "libaudiopolicyservice_dependencies",
        "service_fuzzer_defaults",
    ],
+26 −7
Original line number Diff line number Diff line
@@ -421,8 +421,16 @@ status_t StreamHalAidl::pause(StreamDescriptor::Reply* reply) {
    ALOGD("%p %s::%s", this, getClassName().c_str(), __func__);
    TIME_CHECK();
    if (!mStream) return NO_INIT;
    return sendCommand(makeHalCommand<HalCommand::Tag::pause>(), reply,

    if (const auto state = getState(); isInPlayOrRecordState(state)) {
        return sendCommand(
                makeHalCommand<HalCommand::Tag::pause>(), reply,
                true /*safeFromNonWorkerThread*/);  // The workers stops its I/O activity first.
    } else {
        ALOGD("%s: already stream in one of the PAUSED kind of states, current state: %s", __func__,
              toString(state).c_str());
        return OK;
    }
}

status_t StreamHalAidl::resume(StreamDescriptor::Reply* reply) {
@@ -477,8 +485,19 @@ status_t StreamHalAidl::flush(StreamDescriptor::Reply* reply) {
    ALOGD("%p %s::%s", this, getClassName().c_str(), __func__);
    TIME_CHECK();
    if (!mStream) return NO_INIT;
    return sendCommand(makeHalCommand<HalCommand::Tag::flush>(), reply,

    if (const auto state = getState(); isInPausedState(state)) {
        return sendCommand(
                makeHalCommand<HalCommand::Tag::flush>(), reply,
                true /*safeFromNonWorkerThread*/);  // The workers stops its I/O activity first.
    } else if (isInPlayOrRecordState(state)) {
        ALOGE("%s: found stream in non-flushable state: %s", __func__, toString(state).c_str());
        return INVALID_OPERATION;
    } else {
        ALOGD("%s: already stream in one of the flushable state: current state: %s", __func__,
              toString(state).c_str());
        return OK;
    }
}

status_t StreamHalAidl::exit() {
@@ -802,8 +821,8 @@ status_t StreamOutHalAidl::supportsDrain(bool *supportsDrain) {
status_t StreamOutHalAidl::drain(bool earlyNotify) {
    if (!mStream) return NO_INIT;

    if(const auto state = getState(); state == StreamDescriptor::State::IDLE) {
        ALOGD("%p %s stream already in IDLE state", this, __func__);
    if (const auto state = getState(); isInDrainedState(state)) {
        ALOGD("%p %s stream already in %s", this, __func__, toString(state).c_str());
        if (mContext.isAsynchronous()) onDrainReady();
        return OK;
    }
+35 −0
Original line number Diff line number Diff line
@@ -220,6 +220,41 @@ class StreamHalAidl : public virtual StreamHalInterface, public ConversionHelper
        return mLastReply.state;
    }

    bool isInDrainedState(
            const ::aidl::android::hardware::audio::core::StreamDescriptor::State state) {
        if (state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::IDLE ||
            state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::STANDBY) {
            // drain equivalent states
            return true;
        }
        return false;
    }

    bool isInPlayOrRecordState(
            const ::aidl::android::hardware::audio::core::StreamDescriptor::State state) {
        if (state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::ACTIVE ||
            state ==
                    ::aidl::android::hardware::audio::core::StreamDescriptor::State::TRANSFERRING ||
            state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::DRAINING) {
            // play or record equivalent states
            return true;
        }
        return false;
    }

    bool isInPausedState(
            const ::aidl::android::hardware::audio::core::StreamDescriptor::State& state) {
        if (state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::PAUSED ||
            state ==
                    ::aidl::android::hardware::audio::core::StreamDescriptor::State::DRAIN_PAUSED ||
            state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::
                             TRANSFER_PAUSED) {
            // pause equivalent states
            return true;
        }
        return false;
    }

    status_t getLatency(uint32_t *latency);

    // Always returns non-negative values.
+7 −5
Original line number Diff line number Diff line
@@ -27,10 +27,11 @@ std::string HealthStats::toString() const {
    std::string result;
    const float batteryVoltage = batteryVoltageMillivolts * 1e-3f;  // Volts
    const float charge = batteryChargeCounterUah * (3600 * 1e-6);  // Joules = Amp-Second
    result.append(" battery_voltage: ")
    result.append("{Net Battery V: ")
            .append(std::to_string(batteryVoltage))
            .append(" charge: ")
            .append(std::to_string(charge));
            .append(" J: ")
            .append(std::to_string(charge))
            .append("}");
    return result;
}

@@ -39,12 +40,13 @@ std::string HealthStats::normalizedEnergy(double timeSec) const {
    const float batteryVoltage = batteryVoltageMillivolts * 1e-3f;   // Volts
    const float charge = -batteryChargeCounterUah * (3600 * 1e-6f);  // Joules = Amp-Second
    const float watts = charge * batteryVoltage / timeSec;
    result.append(" battery_voltage: ")
    result.append("{Net Battery V: ")
            .append(std::to_string(batteryVoltage))
            .append(" J: ")
            .append(std::to_string(charge))
            .append(" W: ")
            .append(std::to_string(watts));
            .append(std::to_string(watts))
            .append("}");
    return result;
}

Loading