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

Commit a28a8373 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

MediaCodec: Implement onMetricsFlushed callback

Bug: 363382811
Test: build and boot, manual testing
Flag: android.media.codec.subsession_metrics
Change-Id: Ic46f64232e51bb3040624db896abec016e69f3c5
parent 2e26a3ed
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1461,6 +1461,21 @@ void JMediaCodec::handleCallback(const sp<AMessage> &msg) {
            break;
        }

        case MediaCodec::CB_METRICS_FLUSHED:
        {
            sp<WrapperObject<std::unique_ptr<mediametrics::Item>>> metrics;
            CHECK(msg->findObject("metrics", (sp<RefBase>*)&metrics));

            // metrics should never be null. Not sure if checking it here adds any value.
            if (metrics == nullptr) {
                return;
            }

            mediametrics::Item *item = metrics->value.get();
            obj = MediaMetricsJNI::writeMetricsToBundle(env, item, NULL);
            break;
        }

        default:
            TRESPASS();
    }