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

Commit f6ae7d74 authored by Ray Essick's avatar Ray Essick
Browse files

Better control of when MediaCodec has data for mediametrics

Identify some marker points (configure, release, destruction) where we
can state we have metrics data to dump. Otherwise, we were dumping
skeletal records into the metrics stream causing extra traffic of no
value.

Bug: 274253278
Test: examination of emitted mediametrics data
Change-Id: I60e2ffa19b9d6597447c916a63b02b1f5c1fa37d
parent 5a77c85e
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();