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

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

connect APIs to mediaextractor getMetrics()

plumbing so that user level android.media.MediaExtractor.getMetrics()
will get down to where we keep the metrics and then haul them back
to the application.  Includes the right hooks so that per-container-type
metrics will also be managed.

Bug: 35094936
Test: monitor dumpsys output, augmented CTS examination
parent d2b0b504
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ public:
    // returns an empty metadata object.
    virtual sp<MetaData> getMetaData() = 0;

    virtual status_t getMetrics(Parcel *reply) = 0;

    enum Flags {
        CAN_SEEK_BACKWARD  = 1,  // the "seek 10secs back button"
        CAN_SEEK_FORWARD   = 2,  // the "seek 10secs forward button"
+4 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ public:
    // returns an empty metadata object.
    virtual sp<MetaData> getMetaData();

    status_t getMetrics(Parcel *reply);

    enum Flags {
        CAN_SEEK_BACKWARD  = 1,  // the "seek 10secs back button"
        CAN_SEEK_FORWARD   = 2,  // the "seek 10secs forward button"
@@ -74,6 +76,8 @@ protected:

    MediaAnalyticsItem *mAnalyticsItem;

    virtual void populateMetrics();

private:

    typedef bool (*SnifferFunc)(
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ struct NuMediaExtractor : public RefBase {
    status_t getSampleTrackIndex(size_t *trackIndex);
    status_t getSampleTime(int64_t *sampleTimeUs);
    status_t getSampleMeta(sp<MetaData> *sampleMeta);
    status_t getMetrics(Parcel *reply);

    bool getCachedDuration(int64_t *durationUs, bool *eos) const;

+17 −1
Original line number Diff line number Diff line
@@ -36,7 +36,8 @@ enum {
    FLAGS,
    GETDRMTRACKINFO,
    SETUID,
    NAME
    NAME,
    GETMETRICS
};

class BpMediaExtractor : public BpInterface<IMediaExtractor> {
@@ -94,6 +95,16 @@ public:
        return NULL;
    }

    virtual status_t getMetrics(Parcel * reply) {
        Parcel data;
        data.writeInterfaceToken(BpMediaExtractor::getInterfaceDescriptor());
        status_t ret = remote()->transact(GETMETRICS, data, reply);
        if (ret == NO_ERROR) {
            return OK;
        }
        return UNKNOWN_ERROR;
    }

    virtual uint32_t flags() const {
        ALOGV("flags NOT IMPLEMENTED");
        return 0;
@@ -169,6 +180,11 @@ status_t BnMediaExtractor::onTransact(
            }
            return UNKNOWN_ERROR;
        }
        case GETMETRICS: {
            CHECK_INTERFACE(IMediaExtractor, data, reply);
            status_t ret = getMetrics(reply);
            return ret;
        }
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
+4 −0
Original line number Diff line number Diff line
@@ -5066,6 +5066,10 @@ MPEG4Extractor::Track *MPEG4Extractor::findTrackByMimePrefix(
    return NULL;
}

void MPEG4Extractor::populateMetrics() {
    ALOGV("MPEG4Extractor::populateMetrics");
}

static bool LegacySniffMPEG4(
        const sp<DataSource> &source, String8 *mimeType, float *confidence) {
    uint8_t header[8];
Loading