From 8efae6d25f7d9803da4ef84c59883fbe6c99d03a Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Tue, 3 Mar 2015 08:54:00 -0500 Subject: [PATCH] Bug 1136877 - Collect telemetry on constraint_set flags from canPlayType. r=jya --- dom/media/VideoUtils.cpp | 7 +++++++ toolkit/components/telemetry/Histograms.json | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp index 529d350dbe81..e6a942e8e4d6 100644 --- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -233,6 +233,13 @@ ExtractH264CodecDetails(const nsAString& aCodec, aLevel = PromiseFlatString(Substring(aCodec, 9, 2)).ToInteger(&rv, 16); NS_ENSURE_SUCCESS(rv, false); + // Capture the constraint_set flag value for the purpose of Telemetry. + // We don't NS_ENSURE_SUCCESS here because ExtractH264CodecDetails doesn't + // care about this, but we make sure constraints is above 4 (constraint_set5_flag) + // otherwise collect 0 for unknown. + uint8_t constraints = PromiseFlatString(Substring(aCodec, 7, 2)).ToInteger(&rv, 16); + Telemetry::Accumulate(Telemetry::VIDEO_CANPLAYTYPE_H264_CONSTRAINT_SET_FLAG, + constraints >= 4 ? constraints : 0); // 244 is the highest meaningful profile value (High 4:4:4 Intra Profile) // that can be represented as single hex byte, otherwise collect 0 for unknown. diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 6c7843ba70c9..49881aa87123 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -5467,6 +5467,12 @@ "n_buckets": "1000", "description": "The time (in milliseconds) that it took a 'reconfigure thread' request to go round trip." }, + "VIDEO_CANPLAYTYPE_H264_CONSTRAINT_SET_FLAG": { + "expires_in_version": "40", + "kind": "enumerated", + "n_values": 128, + "description": "The H.264 constraint set flag as extracted from the codecs parameter passed to HTMLMediaElement.canPlayType, with the addition of 0 for unknown values." + }, "VIDEO_CANPLAYTYPE_H264_LEVEL": { "expires_in_version": "40", "kind": "enumerated",