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

Commit 5edc02c5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Better control of when MediaCodec has data for mediametrics" into udc-dev

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

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

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

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

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

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

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