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

Commit 89269d69 authored by Ray Essick's avatar Ray Essick
Browse files

MediaPlayer2 using the new mediametrics stable interface

converts mediaplayer2 to use the new interface.

Bug: 112555455
Test: boot / relevant ctsMediaTests
Change-Id: I186c1931408414e9fd42bbc501e636a9624b6a6e
parent ba8c4842
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -214,6 +214,8 @@ public:
    virtual status_t setParameter(int key, const Parcel &request) = 0;
    virtual status_t getParameter(int key, Parcel *reply) = 0;

    virtual status_t getMetrics(char **buffer, size_t *length) = 0;

    // Invoke a generic method on the player by using opaque parcels
    // for the request and reply.
    //
+1 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public:
            status_t        setAudioAttributes(const jobject attributes);
            jobject         getAudioAttributes();
            status_t        getParameter(int key, Parcel* reply);
            status_t        getMetrics(char **buffer, size_t *length);

            // Modular DRM
            status_t        prepareDrm(int64_t srcId,
+16 −1
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
#include <android/binder_ibinder.h>
#include <media/AudioSystem.h>
#include <media/DataSourceDesc.h>
#include <media/MediaAnalyticsItem.h>
#include <media/MemoryLeakTrackUtil.h>
#include <media/NdkWrapper.h>
#include <media/stagefright/foundation/ADebug.h>
@@ -979,6 +978,22 @@ status_t MediaPlayer2::getParameter(int key, Parcel *reply) {
    return status;
}

// for mediametrics
status_t MediaPlayer2::getMetrics(char **buffer, size_t *length) {
    ALOGD("MediaPlayer2::getMetrics()");
    Mutex::Autolock _l(mLock);
    if (mPlayer == NULL) {
        ALOGV("getMetrics: no active player");
        return INVALID_OPERATION;
    }

    status_t status =  mPlayer->getMetrics(buffer, length);
    if (status != OK) {
        ALOGD("getMetrics returns %d", status);
    }
    return status;
}

void MediaPlayer2::notify(int64_t srcId, int msg, int ext1, int ext2, const PlayerMessage *obj) {
    ALOGV("message received srcId=%lld, msg=%d, ext1=%d, ext2=%d",
          (long long)srcId, msg, ext1, ext2);
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ cc_library_static {
        "libui",
        "libgui",
        "libmedia",
        "libmediametrics",
        "libmediandk",
        "libmediandk_utils",
        "libpowermanager",
+2 −0
Original line number Diff line number Diff line
@@ -107,6 +107,8 @@ sp<AMessage> NuPlayer2::Decoder::getStats() const {
    mStats->setInt64("frames-total", mNumFramesTotal);
    mStats->setInt64("frames-dropped-input", mNumInputFramesDropped);
    mStats->setInt64("frames-dropped-output", mNumOutputFramesDropped);
    mStats->setFloat("frame-rate-total", mFrameRateTotal);

    return mStats;
}

Loading