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

Commit 3761451a authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6545159 from 8ef081fc to mainline-release

Change-Id: I9196a43f9506a06abb7fba49c758d830ca40fd91
parents c3530677 8ef081fc
Loading
Loading
Loading
Loading

MainlineFiles.cfg

0 → 100644
+34 −0
Original line number Diff line number Diff line
# 
# mainline files for frameworks/av
#
# ignore comment (#) lines and blank lines
# rest are path prefixes starting at root of the project
# (so OWNERS, not frameworks/av/OWNERS)
# 
# path
# INCLUDE path
# EXCLUDE path
#
# 'path' and 'INCLUDE path' are identical -- they both indicate that this path
# is part of mainline
# EXCLUDE indicates that this is not part of mainline,
# so 'foo/' and 'EXCLUDE foo/nope'
# means everything under foo/ is part of mainline EXCEPT foo/nope.
# INCLUDE/EXCLUDE/INCLUDE nested structuring is not supported
#
# matching is purely prefix
# so 'foo' will match 'foo', 'foo.c', 'foo/bar/baz'
# if you want to exclude a directory, best to use a pattern like "foo/"
#

media/codec2/components/
media/codecs/
media/extractors/
media/libstagefright/codecs/amrnb/
media/libstagefright/codecs/amrwb/
media/libstagefright/codecs/amrwbenc/
media/libstagefright/codecs/common/
media/libstagefright/codecs/flac/
media/libstagefright/codecs/m4v_h263/
media/libstagefright/codecs/mp3dec/
media/libstagefright/mpeg2ts
+6 −3
Original line number Diff line number Diff line
@@ -278,16 +278,19 @@ typedef C2GlobalParam<C2Setting, C2SimpleValueStruct<C2Config::api_level_t>, kPa
        C2ApiLevelSetting;
constexpr char C2_PARAMKEY_API_LEVEL[] = "api.level";

enum C2Config::api_feature_t : uint64_t {
C2ENUM(C2Config::api_feature_t, uint64_t,
    API_REFLECTION       = (1U << 0),  ///< ability to list supported parameters
    API_VALUES           = (1U << 1),  ///< ability to list supported values for each parameter
    API_CURRENT_VALUES   = (1U << 2),  ///< ability to list currently supported values for each parameter
    API_DEPENDENCY       = (1U << 3),  ///< have a defined parameter dependency

    API_SAME_INPUT_BUFFER = (1U << 16),   ///< supporting multiple input buffers
                                          ///< backed by the same allocation

    API_STREAMS          = (1ULL << 32),  ///< supporting variable number of streams

    API_TUNNELING        = (1ULL << 48),  ///< tunneling API
};
    API_TUNNELING        = (1ULL << 48)   ///< tunneling API
)

// read-only
typedef C2GlobalParam<C2Setting, C2SimpleValueStruct<C2Config::api_feature_t>, kParamIndexApiFeatures>
+38 −3
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@
#include <media/stagefright/BufferProducerWrapper.h>
#include <media/stagefright/CCodec.h>
#include <media/stagefright/MediaCodec.h>
#include <media/stagefright/MediaCodecConstants.h>
#include <media/stagefright/MediaCodecList.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaErrors.h>
@@ -95,9 +96,12 @@ static const char *kCodecRotation = "android.media.mediacodec.rotation-degrees";
static const char *kCodecCrypto = "android.media.mediacodec.crypto";   /* 0,1 */
static const char *kCodecProfile = "android.media.mediacodec.profile";  /* 0..n */
static const char *kCodecLevel = "android.media.mediacodec.level";  /* 0..n */
static const char *kCodecBitrateMode = "android.media.mediacodec.bitrate_mode";  /* CQ/VBR/CBR */
static const char *kCodecBitrate = "android.media.mediacodec.bitrate";  /* 0..n */
static const char *kCodecMaxWidth = "android.media.mediacodec.maxwidth";  /* 0..n */
static const char *kCodecMaxHeight = "android.media.mediacodec.maxheight";  /* 0..n */
static const char *kCodecError = "android.media.mediacodec.errcode";
static const char *kCodecLifetimeMs = "android.media.mediacodec.lifetimeMs";   /* 0..n ms*/
static const char *kCodecErrorState = "android.media.mediacodec.errstate";
static const char *kCodecLatencyMax = "android.media.mediacodec.latency.max";   /* in us */
static const char *kCodecLatencyMin = "android.media.mediacodec.latency.min";   /* in us */
@@ -619,7 +623,6 @@ MediaCodec::MediaCodec(const sp<ALooper> &looper, pid_t pid, uid_t uid)
      mFlags(0),
      mStickyError(OK),
      mSoftRenderer(NULL),
      mMetricsHandle(0),
      mIsVideo(false),
      mVideoWidth(0),
      mVideoHeight(0),
@@ -679,6 +682,8 @@ void MediaCodec::initMediametrics() {
        mIndexOfFirstFrameWhenLowLatencyOn = -1;
        mInputBufferCounter = 0;
    }

    mLifetimeStartNs = systemTime(SYSTEM_TIME_MONOTONIC);
}

void MediaCodec::updateMediametrics() {
@@ -687,7 +692,6 @@ void MediaCodec::updateMediametrics() {
        return;
    }


    if (mLatencyHist.getCount() != 0 ) {
        mediametrics_setInt64(mMetricsHandle, kCodecLatencyMax, mLatencyHist.getMax());
        mediametrics_setInt64(mMetricsHandle, kCodecLatencyMin, mLatencyHist.getMin());
@@ -703,6 +707,11 @@ void MediaCodec::updateMediametrics() {
    if (mLatencyUnknown > 0) {
        mediametrics_setInt64(mMetricsHandle, kCodecLatencyUnknown, mLatencyUnknown);
    }
    if (mLifetimeStartNs > 0) {
        nsecs_t lifetime = systemTime(SYSTEM_TIME_MONOTONIC) - mLifetimeStartNs;
        lifetime = lifetime / (1000 * 1000);    // emitted in ms, truncated not rounded
        mediametrics_setInt64(mMetricsHandle, kCodecLifetimeMs, lifetime);
    }

    {
        Mutex::Autolock al(mLatencyLock);
@@ -740,7 +749,6 @@ void MediaCodec::updateEphemeralMediametrics(mediametrics_handle_t item) {
        }
    }


    // spit the data (if any) into the supplied analytics record
    if (recentHist.getCount()!= 0 ) {
        mediametrics_setInt64(item, kCodecRecentLatencyMax, recentHist.getMax());
@@ -2309,6 +2317,8 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                        // meaningful and confusing for an encoder in a transcoder scenario
                        mInputFormat->setInt32("allow-frame-drop", mAllowFrameDroppingBySurface);
                    }
                    sp<AMessage> interestingFormat =
                            (mFlags & kFlagIsEncoder) ? mOutputFormat : mInputFormat;
                    ALOGV("[%s] configured as input format: %s, output format: %s",
                            mComponentName.c_str(),
                            mInputFormat->debugString(4).c_str(),
@@ -2322,6 +2332,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                    (new AMessage)->postReply(mReplyID);

                    // augment our media metrics info, now that we know more things
                    // such as what the codec extracted from any CSD passed in.
                    if (mMetricsHandle != 0) {
                        sp<AMessage> format;
                        if (mConfigureMsg != NULL &&
@@ -2333,6 +2344,30 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                                                            mime.c_str());
                                }
                            }
                        // perhaps video only?
                        int32_t profile = 0;
                        if (interestingFormat->findInt32("profile", &profile)) {
                            mediametrics_setInt32(mMetricsHandle, kCodecProfile, profile);
                        }
                        int32_t level = 0;
                        if (interestingFormat->findInt32("level", &level)) {
                            mediametrics_setInt32(mMetricsHandle, kCodecLevel, level);
                        }
                        // bitrate and bitrate mode, encoder only
                        if (mFlags & kFlagIsEncoder) {
                            // encoder specific values
                            int32_t bitrate_mode = -1;
                            if (mOutputFormat->findInt32(KEY_BITRATE_MODE, &bitrate_mode)) {
                                    mediametrics_setCString(mMetricsHandle, kCodecBitrateMode,
                                          asString_BitrateMode(bitrate_mode));
                            }
                            int32_t bitrate = -1;
                            if (mOutputFormat->findInt32(KEY_BIT_RATE, &bitrate)) {
                                    mediametrics_setInt32(mMetricsHandle, kCodecBitrate, bitrate);
                            }
                        } else {
                            // decoder specific values
                        }
                    }
                    break;
                }
+2 −1
Original line number Diff line number Diff line
@@ -371,7 +371,8 @@ private:
    sp<Surface> mSurface;
    SoftwareRenderer *mSoftRenderer;

    mediametrics_handle_t mMetricsHandle;
    mediametrics_handle_t mMetricsHandle = 0;
    nsecs_t mLifetimeStartNs = 0;
    void initMediametrics();
    void updateMediametrics();
    void flushMediametrics();
+22 −0
Original line number Diff line number Diff line
@@ -168,6 +168,28 @@ bool statsd_codec(const mediametrics::Item *item)
    }
    // android.media.mediacodec.latency.hist    NOT EMITTED

#if 0
    // TODO(b/139143194)
    // can't send them to statsd until statsd proto updates merge
    // but in the meantime, they can appear in local 'dumpsys media.metrics' output
    //
    // android.media.mediacodec.bitrate_mode string
    std::string bitrate_mode;
    if (item->getString("android.media.mediacodec.bitrate_mode", &bitrate_mode)) {
        metrics_proto.set_bitrate_mode(std::move(bitrate_mode));
    }
    // android.media.mediacodec.bitrate int32
    int32_t bitrate = -1;
    if (item->getInt32("android.media.mediacodec.bitrate", &bitrate)) {
        metrics_proto.set_bitrate(bitrate);
    }
    // android.media.mediacodec.lifetimeMs int64
    int64_t lifetimeMs = -1;
    if ( item->getInt64("android.media.mediacodec.lifetimeMs", &lifetimeMs)) {
        metrics_proto.set_lifetime_millis(lifetimeMs);
    }
#endif

    std::string serialized;
    if (!metrics_proto.SerializeToString(&serialized)) {
        ALOGE("Failed to serialize codec metrics");
Loading