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

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

Merge "MediaMetrics: Change the duplicate logging suffix"

parents 9073e804 8f06962f
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -75,16 +75,21 @@
// followed by one or more characters in the range [a-zA-Z0-9_.].
// Special symbols such as !@#$%^&*()[]{}<>,:;'"\/?|+-=~ are reserved.
//
// A property that ends with a ! will have duplicate values listed instead
// Properties within this header should include special suffixes like '#'
// directly in the string for brevity.  Code outside of this header should
// use the macro constant for the special symbols for searchability.

// Any property that ends with a # will have duplicate values listed instead
// of suppressed in the Time Machine.
//
#define AMEDIAMETRICS_PROP_SUFFIX_CHAR_DUPLICATES_ALLOWED '#'

#define AMEDIAMETRICS_PROP_AUXEFFECTID    "auxEffectId"    // int32 (AudioTrack)
#define AMEDIAMETRICS_PROP_CHANNELCOUNT   "channelCount"   // int32
#define AMEDIAMETRICS_PROP_CHANNELMASK    "channelMask"    // int32
#define AMEDIAMETRICS_PROP_CONTENTTYPE    "contentType"    // string attributes (AudioTrack)
#define AMEDIAMETRICS_PROP_DURATIONNS     "durationNs"     // int64 duration time span
#define AMEDIAMETRICS_PROP_ENCODING       "encoding"       // string value of format
#define AMEDIAMETRICS_PROP_EVENT          "event!"         // string value (often func name)
#define AMEDIAMETRICS_PROP_EVENT          "event#"         // string value (often func name)

// TODO: fix inconsistency in flags: AudioRecord / AudioTrack int32,  AudioThread string
#define AMEDIAMETRICS_PROP_FLAGS          "flags"
+3 −2
Original line number Diff line number Diff line
@@ -56,7 +56,8 @@ std::ostream & operator<< (std::ostream& s,
 * The TimeMachine is used to record timing changes of MediaAnalyticItem
 * properties.
 *
 * Any URL that ends with '!' will have a time sequence that keeps duplicates.
 * Any URL that ends with '#' (AMEDIAMETRICS_PROP_SUFFIX_CHAR_DUPLICATES_ALLOWED)
 * will have a time sequence that keeps duplicates.
 *
 * The TimeMachine is NOT thread safe.
 */
@@ -126,7 +127,7 @@ private:
            auto& timeSequence = mPropertyMap[property];
            Elem el{std::forward<T>(e)};
            if (timeSequence.empty()           // no elements
                    || property.back() == '!'  // keep duplicates TODO: remove?
                    || property.back() == AMEDIAMETRICS_PROP_SUFFIX_CHAR_DUPLICATES_ALLOWED
                    || timeSequence.rbegin()->second != el) { // value changed
                timeSequence.emplace(time, std::move(el));
            }