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

Commit 30f66084 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Better control of when MediaCodec has data for mediametrics" into udc-dev am: 5edc02c5

parents 0faa87f0 5edc02c5
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -1235,12 +1235,14 @@ void MediaCodec::flushMediametrics() {
    // ensure mutex while we do our own work
    // ensure mutex while we do our own work
    Mutex::Autolock _lock(mMetricsLock);
    Mutex::Autolock _lock(mMetricsLock);
    if (mMetricsHandle != 0) {
    if (mMetricsHandle != 0) {
        if (mediametrics_count(mMetricsHandle) > 0) {
        if (mMetricsToUpload && mediametrics_count(mMetricsHandle) > 0) {
            mediametrics_selfRecord(mMetricsHandle);
            mediametrics_selfRecord(mMetricsHandle);
        }
        }
        mediametrics_delete(mMetricsHandle);
        mediametrics_delete(mMetricsHandle);
        mMetricsHandle = 0;
        mMetricsHandle = 0;
    }
    }
    // we no longer have anything pending upload
    mMetricsToUpload = false;
}
}


void MediaCodec::updateLowLatency(const sp<AMessage> &msg) {
void MediaCodec::updateLowLatency(const sp<AMessage> &msg) {
@@ -1839,6 +1841,7 @@ status_t MediaCodec::configure(
        const sp<ICrypto> &crypto,
        const sp<ICrypto> &crypto,
        const sp<IDescrambler> &descrambler,
        const sp<IDescrambler> &descrambler,
        uint32_t flags) {
        uint32_t flags) {

    sp<AMessage> msg = new AMessage(kWhatConfigure, this);
    sp<AMessage> msg = new AMessage(kWhatConfigure, this);
    mediametrics_handle_t nextMetricsHandle = mediametrics_create(kCodecKeyName);
    mediametrics_handle_t nextMetricsHandle = mediametrics_create(kCodecKeyName);


@@ -4175,6 +4178,10 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                initMediametrics();
                initMediametrics();
            }
            }


            // from this point forward, in this configure/use/release lifecycle, we want to
            // upload our data
            mMetricsToUpload = true;

            int32_t push;
            int32_t push;
            if (msg->findInt32("push-blank-buffers-on-shutdown", &push) && push != 0) {
            if (msg->findInt32("push-blank-buffers-on-shutdown", &push) && push != 0) {
                mFlags |= kFlagPushBlankBuffersOnShutdown;
                mFlags |= kFlagPushBlankBuffersOnShutdown;
+1 −0
Original line number Original line Diff line number Diff line
@@ -442,6 +442,7 @@ private:


    Mutex mMetricsLock;
    Mutex mMetricsLock;
    mediametrics_handle_t mMetricsHandle = 0;
    mediametrics_handle_t mMetricsHandle = 0;
    bool mMetricsToUpload = false;
    nsecs_t mLifetimeStartNs = 0;
    nsecs_t mLifetimeStartNs = 0;
    void initMediametrics();
    void initMediametrics();
    void updateMediametrics();
    void updateMediametrics();