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

Commit fa06ca74 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "MediaMetrics: Fix legacy AudioTrack AudioRecord protos" into sc-v2-dev

parents da7cd05c 89caac13
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -80,16 +80,20 @@ bool statsd_audiorecord(const std::shared_ptr<const mediametrics::Item>& item,
    }

    int64_t created_millis = -1;
    // not currently sent from client.
    if (item->getInt64("android.media.audiorecord.createdMs", &created_millis)) {
        metrics_proto.set_created_millis(created_millis);
    }

    int64_t duration_millis = -1;
    if (item->getInt64("android.media.audiorecord.durationMs", &duration_millis)) {
    double durationMs = 0.;
    if (item->getDouble("android.media.audiorecord.durationMs", &durationMs)) {
        duration_millis = (int64_t)durationMs;
        metrics_proto.set_duration_millis(duration_millis);
    }

    int32_t count = -1;
    // not currently sent from client.  (see start count instead).
    if (item->getInt32("android.media.audiorecord.n", &count)) {
        metrics_proto.set_count(count);
    }
@@ -129,7 +133,7 @@ bool statsd_audiorecord(const std::shared_ptr<const mediametrics::Item>& item,
    }

    int64_t start_count = -1;
    if (item->getInt64("android.media.audiorecord.startcount", &start_count)) {
    if (item->getInt64("android.media.audiorecord.startCount", &start_count)) {
        metrics_proto.set_start_count(start_count);
    }

+9 −14
Original line number Diff line number Diff line
@@ -56,52 +56,47 @@ bool statsd_audiotrack(const std::shared_ptr<const mediametrics::Item>& item,
    // flesh out the protobuf we'll hand off with our data
    //

    // static constexpr char kAudioTrackStreamType[] = "android.media.audiotrack.streamtype";
    // Do not change this without changing AudioTrack.cpp collection.

    // optional string streamType;
    std::string stream_type;
    if (item->getString("android.media.audiotrack.streamtype", &stream_type)) {
        metrics_proto.set_stream_type(stream_type);
    }

    // static constexpr char kAudioTrackContentType[] = "android.media.audiotrack.type";
    // optional string contentType;
    std::string content_type;
    if (item->getString("android.media.audiotrack.type", &content_type)) {
        metrics_proto.set_content_type(content_type);
    }

    // static constexpr char kAudioTrackUsage[] = "android.media.audiotrack.usage";
    // optional string trackUsage;
    std::string track_usage;
    if (item->getString("android.media.audiotrack.usage", &track_usage)) {
        metrics_proto.set_track_usage(track_usage);
    }

    // static constexpr char kAudioTrackSampleRate[] = "android.media.audiotrack.samplerate";
    // optional int32 samplerate;
    // optional int32 sampleRate;
    int32_t sample_rate = -1;
    if (item->getInt32("android.media.audiotrack.samplerate", &sample_rate)) {
    if (item->getInt32("android.media.audiotrack.sampleRate", &sample_rate)) {
        metrics_proto.set_sample_rate(sample_rate);
    }

    // static constexpr char kAudioTrackChannelMask[] = "android.media.audiotrack.channelmask";
    // optional int64 channelMask;
    int64_t channel_mask = -1;
    if (item->getInt64("android.media.audiotrack.channelmask", &channel_mask)) {
    if (item->getInt64("android.media.audiotrack.channelMask", &channel_mask)) {
        metrics_proto.set_channel_mask(channel_mask);
    }

    // NB: These are not yet exposed as public Java API constants.
    // static constexpr char kAudioTrackUnderrunFrames[] = "android.media.audiotrack.underrunframes";
    // optional int32 underrunframes;
    // optional int32 underrunFrames;
    int32_t underrun_frames = -1;
    if (item->getInt32("android.media.audiotrack.underrunframes", &underrun_frames)) {
    if (item->getInt32("android.media.audiotrack.underrunFrames", &underrun_frames)) {
        metrics_proto.set_underrun_frames(underrun_frames);
    }

    // static constexpr char kAudioTrackStartupGlitch[] = "android.media.audiotrack.glitch.startup";
    // optional int32 startupglitch;
    // optional int32 glitch.startup;
    int32_t startup_glitch = -1;
    // Not currently sent from client.
    if (item->getInt32("android.media.audiotrack.glitch.startup", &startup_glitch)) {
        metrics_proto.set_startup_glitch(startup_glitch);
    }