summaryrefslogtreecommitdiffstats
path: root/media/blink/webmediaplayer_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'media/blink/webmediaplayer_util.cc')
-rw-r--r--media/blink/webmediaplayer_util.cc35
1 files changed, 34 insertions, 1 deletions
diff --git a/media/blink/webmediaplayer_util.cc b/media/blink/webmediaplayer_util.cc
index 1b41ee8..fc1a079 100644
--- a/media/blink/webmediaplayer_util.cc
+++ b/media/blink/webmediaplayer_util.cc
@@ -8,6 +8,7 @@
#include "base/metrics/histogram.h"
#include "media/base/bind_to_current_loop.h"
+#include "media/base/media_client.h"
#include "media/base/media_keys.h"
#include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
@@ -106,11 +107,43 @@ URLSchemeForHistogram URLScheme(const GURL& url) {
return kUnknownURLScheme;
}
+std::string LoadTypeToString(blink::WebMediaPlayer::LoadType load_type) {
+ switch (load_type) {
+ case blink::WebMediaPlayer::LoadTypeURL:
+ return "SRC";
+ case blink::WebMediaPlayer::LoadTypeMediaSource:
+ return "MSE";
+ case blink::WebMediaPlayer::LoadTypeMediaStream:
+ return "MS";
+ }
+
+ NOTREACHED();
+ return "Unknown";
+}
+
} // namespace
-void ReportMediaSchemeUma(const GURL& url) {
+// TODO(xhwang): Call this from WebMediaPlayerMS to report metrics for
+// MediaStream as well.
+void ReportMetrics(blink::WebMediaPlayer::LoadType load_type,
+ const GURL& url,
+ const GURL& origin_url) {
+ // Report URL scheme, such as http, https, file, blob etc.
UMA_HISTOGRAM_ENUMERATION("Media.URLScheme", URLScheme(url),
kMaxURLScheme + 1);
+
+ // Keep track if this is a MSE or non-MSE playback.
+ // TODO(xhwang): This name is not intuitive. We should have a histogram for
+ // all load types.
+ UMA_HISTOGRAM_BOOLEAN(
+ "Media.MSE.Playback",
+ load_type == blink::WebMediaPlayer::LoadTypeMediaSource);
+
+ // Report the origin from where the media player is created.
+ if (GetMediaClient()) {
+ GetMediaClient()->RecordRapporURL(
+ "Media.OriginUrl." + LoadTypeToString(load_type), origin_url);
+ }
}
EmeInitDataType ConvertToEmeInitDataType(