Skip to content

Commit

Permalink
Cherry pick PR #3109: [media] Add UMA metrics for color space info (#…
Browse files Browse the repository at this point in the history
…3111)

Refer to the original PR: #3109

Now primaries, transfer, matrix, and range ids for both SDR and HDR
playbacks are reported to UMA.

b/322027866

Change-Id: Id58f73684404a5d8fc1051ca5a4c6b6083c8ff19

Co-authored-by: xiaomings <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and xiaomings authored Apr 30, 2024
1 parent f337bdc commit c435146
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cobalt/media/base/sbplayer_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "base/compiler_specific.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/trace_event/trace_event.h"
#include "cobalt/base/statistics.h"
#include "cobalt/media/base/format_support_query_metrics.h"
Expand Down Expand Up @@ -273,6 +274,7 @@ SbPlayerBridge::SbPlayerBridge(
}
if (video_config.IsValidConfig()) {
UpdateVideoConfig(video_config, video_mime_type);
SendColorSpaceHistogram();
}

output_mode_ = ComputeSbPlayerOutputMode(default_output_mode);
Expand Down Expand Up @@ -1360,5 +1362,23 @@ void SbPlayerBridge::LogStartupLatency() const {
// clang-format on
}

void SbPlayerBridge::SendColorSpaceHistogram() const {
using base::UmaHistogramEnumeration;

const auto& cs_info = video_config_.color_space_info();

if (video_stream_info_.color_metadata.bits_per_channel > 8) {
UmaHistogramEnumeration("Cobalt.Media.HDR.Primaries", cs_info.primaries);
UmaHistogramEnumeration("Cobalt.Media.HDR.Transfer", cs_info.transfer);
UmaHistogramEnumeration("Cobalt.Media.HDR.Matrix", cs_info.matrix);
UmaHistogramEnumeration("Cobalt.Media.HDR.Range", cs_info.range);
} else {
UmaHistogramEnumeration("Cobalt.Media.SDR.Primaries", cs_info.primaries);
UmaHistogramEnumeration("Cobalt.Media.SDR.Transfer", cs_info.transfer);
UmaHistogramEnumeration("Cobalt.Media.SDR.Matrix", cs_info.matrix);
UmaHistogramEnumeration("Cobalt.Media.SDR.Range", cs_info.range);
}
}

} // namespace media
} // namespace cobalt
1 change: 1 addition & 0 deletions cobalt/media/base/sbplayer_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class SbPlayerBridge {
SbPlayerOutputMode default_output_mode) const;

void LogStartupLatency() const;
void SendColorSpaceHistogram() const;

// The following variables are initialized in the ctor and never changed.
#if SB_HAS(PLAYER_WITH_URL)
Expand Down
71 changes: 71 additions & 0 deletions tools/metrics/histograms/metadata/cobalt/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,77 @@ https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histogra
<int value="24" label="PLAYBACK_CAPABILITY_CHANGED (deprecated)"/>
</enum>

<enum name="PrimaryID">
<summary>
Possible primary ids reported by the Media Pipeline
</summary>
<int value="0" label="INVALID"/>
<int value="1" label="BT709"/>
<int value="2" label="UNSPECIFIED"/>
<int value="4" label="BT470M"/>
<int value="5" label="BT470BG"/>
<int value="6" label="SMPTE170M"/>
<int value="7" label="SMPTE240M"/>
<int value="8" label="FILM"/>
<int value="9" label="BT2020"/>
<int value="10" label="SMPTEST428_1"/>
<int value="11" label="SMPTEST431_2"/>
<int value="12" label="SMPTEST432_1"/>
<int value="22" label="EBU_3213_E"/>
</enum>

<enum name="TransferID">
<summary>
Possible transfer ids reported by the Media Pipeline
</summary>
<int value="0" label="INVALID"/>
<int value="1" label="BT709"/>
<int value="2" label="UNSPECIFIED"/>
<int value="4" label="GAMMA22"/>
<int value="5" label="GAMMA28"/>
<int value="6" label="SMPTE170M"/>
<int value="7" label="SMPTE240M"/>
<int value="8" label="LINEAR"/>
<int value="9" label="LOG"/>
<int value="10" label="LOG_SQRT"/>
<int value="11" label="IEC61966_2_4"/>
<int value="12" label="BT1361_ECG"/>
<int value="13" label="IEC61966_2_1"/>
<int value="14" label="BT2020_10"/>
<int value="15" label="BT2020_12"/>
<int value="16" label="SMPTEST2084"/>
<int value="17" label="SMPTEST428_1"/>
<int value="18" label="ARIB_STD_B67"/>
</enum>

<enum name="MatrixID">
<summary>
Possible matrix ids reported by the Media Pipeline
</summary>
<int value="0" label="RGB"/>
<int value="1" label="BT709"/>
<int value="2" label="UNSPECIFIED"/>
<int value="4" label="FCC"/>
<int value="5" label="BT470BG"/>
<int value="6" label="SMPTE170M"/>
<int value="7" label="SMPTE240M"/>
<int value="8" label="YCOCG"/>
<int value="9" label="BT2020_NCL"/>
<int value="10" label="BT2020_CL"/>
<int value="11" label="YDZDX"/>
<int value="255" label="INVALID"/>
</enum>

<enum name="RangeID">
<summary>
Possible range ids reported by the Media Pipeline
</summary>
<int value="0" label="INVALID"/>
<int value="1" label="LIMITED"/>
<int value="2" label="LIMITED"/>
<int value="3" label="DERIVED"/>
</enum>

<enum name="CrashpadInstallationStatus">
<summary>
Possible status of Crashpad installation by the Loader App
Expand Down
68 changes: 68 additions & 0 deletions tools/metrics/histograms/metadata/cobalt/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,40 @@ Always run the pretty print utility on this file after editing:
</summary>
</histogram>

<histogram name="Cobalt.Media.HDR.Matrix" enum="MatrixID" expires_after="never">
<!-- expires-never: Needed for baseline Media pipeline health metric. -->

<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>Matrix id used in HDR playbacks.</summary>
</histogram>

<histogram name="Cobalt.Media.HDR.Primaries" enum="PrimaryID"
expires_after="never">
<!-- expires-never: Needed for baseline Media pipeline health metric. -->

<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>Primary id used in HDR playbacks.</summary>
</histogram>

<histogram name="Cobalt.Media.HDR.Range" enum="RangeID" expires_after="never">
<!-- expires-never: Needed for baseline Media pipeline health metric. -->

<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>Range id used in HDR playbacks.</summary>
</histogram>

<histogram name="Cobalt.Media.HDR.Transfer" enum="TransferID"
expires_after="never">
<!-- expires-never: Needed for baseline Media pipeline health metric. -->

<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>Transfer id used in HDR playbacks.</summary>
</histogram>

<histogram name="Cobalt.Media.HTMLMediaElement.CanPlayType.Timing"
units="microseconds" expires_after="never">
<!-- expires-never: Needed for long-term tracking of format query latency. -->
Expand Down Expand Up @@ -260,6 +294,40 @@ Always run the pretty print utility on this file after editing:
<summary>Timing data for the destruction of SbPlayer.</summary>
</histogram>

<histogram name="Cobalt.Media.SDR.Matrix" enum="MatrixID" expires_after="never">
<!-- expires-never: Needed for baseline Media pipeline health metric. -->

<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>Matrix id used in SDR playbacks.</summary>
</histogram>

<histogram name="Cobalt.Media.SDR.Primaries" enum="PrimaryID"
expires_after="never">
<!-- expires-never: Needed for baseline Media pipeline health metric. -->

<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>Primary id used in SDR playbacks.</summary>
</histogram>

<histogram name="Cobalt.Media.SDR.Range" enum="RangeID" expires_after="never">
<!-- expires-never: Needed for baseline Media pipeline health metric. -->

<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>Range id used in SDR playbacks.</summary>
</histogram>

<histogram name="Cobalt.Media.SDR.Transfer" enum="TransferID"
expires_after="never">
<!-- expires-never: Needed for baseline Media pipeline health metric. -->

<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>Transfer id used in SDR playbacks.</summary>
</histogram>

<histogram name="Cobalt.Media.SourceBuffer.AppendBuffer.Timing"
units="microseconds" expires_after="never">
<!-- expires-never: Needed for long-term tracking of SourceBuffer latency. -->
Expand Down

0 comments on commit c435146

Please sign in to comment.