Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: content/browser/media/media_internals.cc

Issue 770423004: Add dedicated PipelineStatus UMAs for encrypted playback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CL comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/media/media_internals.h" 5 #include "content/browser/media/media_internals.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 #include "content/public/browser/notification_types.h" 15 #include "content/public/browser/notification_types.h"
16 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
17 #include "content/public/browser/web_ui.h" 17 #include "content/public/browser/web_ui.h"
18 #include "media/audio/audio_parameters.h" 18 #include "media/audio/audio_parameters.h"
19 #include "media/base/media_log_event.h" 19 #include "media/base/media_log_event.h"
20 #include "media/filters/decrypting_video_decoder.h"
20 #include "media/filters/gpu_video_decoder.h" 21 #include "media/filters/gpu_video_decoder.h"
21 22
22 namespace { 23 namespace {
23 24
24 static base::LazyInstance<content::MediaInternals>::Leaky g_media_internals = 25 static base::LazyInstance<content::MediaInternals>::Leaky g_media_internals =
25 LAZY_INSTANCE_INITIALIZER; 26 LAZY_INSTANCE_INITIALIZER;
26 27
27 base::string16 SerializeUpdate(const std::string& function, 28 base::string16 SerializeUpdate(const std::string& function,
28 const base::Value* value) { 29 const base::Value* value) {
29 return content::WebUI::GetJavascriptCall( 30 return content::WebUI::GetJavascriptCall(
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 192
192 // Helper function to save the event payload to RendererPlayerMap. 193 // Helper function to save the event payload to RendererPlayerMap.
193 void SavePlayerState(const media::MediaLogEvent& event, 194 void SavePlayerState(const media::MediaLogEvent& event,
194 int render_process_id); 195 int render_process_id);
195 196
196 private: 197 private:
197 struct PipelineInfo { 198 struct PipelineInfo {
198 media::PipelineStatus last_pipeline_status; 199 media::PipelineStatus last_pipeline_status;
199 bool has_audio; 200 bool has_audio;
200 bool has_video; 201 bool has_video;
202 bool video_dds;
201 std::string audio_codec_name; 203 std::string audio_codec_name;
202 std::string video_codec_name; 204 std::string video_codec_name;
203 std::string video_decoder; 205 std::string video_decoder;
204 PipelineInfo() 206 PipelineInfo()
205 : last_pipeline_status(media::PIPELINE_OK), 207 : last_pipeline_status(media::PIPELINE_OK),
206 has_audio(false), 208 has_audio(false),
207 has_video(false) {} 209 has_video(false),
210 video_dds(false) {}
208 }; 211 };
209 212
210 // Helper function to report PipelineStatus associated with a player to UMA. 213 // Helper function to report PipelineStatus associated with a player to UMA.
211 void ReportUMAForPipelineStatus(const PipelineInfo& player_info); 214 void ReportUMAForPipelineStatus(const PipelineInfo& player_info);
212 215
216 // Helper to generate pipelinestatus UMA name for AudioVideo streams.
xhwang 2014/12/04 21:15:22 pipelinestatus are two words, either "pipeline sta
prabhur1 2014/12/05 01:29:22 Done.
217 std::string GetUMANameForAVStream(const PipelineInfo& player_info);
218
213 // Key is playerid 219 // Key is playerid
214 typedef std::map<int, PipelineInfo> PlayerInfoMap; 220 typedef std::map<int, PipelineInfo> PlayerInfoMap;
215 221
216 // Key is renderer id 222 // Key is renderer id
217 typedef std::map<int, PlayerInfoMap> RendererPlayerMap; 223 typedef std::map<int, PlayerInfoMap> RendererPlayerMap;
218 224
219 // Stores player information per renderer 225 // Stores player information per renderer
220 RendererPlayerMap renderer_info_; 226 RendererPlayerMap renderer_info_;
221 227
222 NotificationRegistrar registrar_; 228 NotificationRegistrar registrar_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 &player_info[event.id].audio_codec_name); 285 &player_info[event.id].audio_codec_name);
280 } 286 }
281 if (event.params.HasKey("video_codec_name")) { 287 if (event.params.HasKey("video_codec_name")) {
282 event.params.GetString("video_codec_name", 288 event.params.GetString("video_codec_name",
283 &player_info[event.id].video_codec_name); 289 &player_info[event.id].video_codec_name);
284 } 290 }
285 if (event.params.HasKey("video_decoder")) { 291 if (event.params.HasKey("video_decoder")) {
286 event.params.GetString("video_decoder", 292 event.params.GetString("video_decoder",
287 &player_info[event.id].video_decoder); 293 &player_info[event.id].video_decoder);
288 } 294 }
295 if (event.params.HasKey("video_dds")) {
296 event.params.GetBoolean("video_dds", &player_info[event.id].video_dds);
297 }
289 break; 298 break;
290 default: 299 default:
291 break; 300 break;
292 } 301 }
293 return; 302 return;
294 } 303 }
295 304
305 std::string MediaInternals::MediaInternalsUMAHandler::GetUMANameForAVStream(
306 const PipelineInfo& player_info) {
307 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
308 static const char kPipelineUmaPrefix[] = "Media.PipelineStatus.AudioVideo.";
309 std::string uma_name = kPipelineUmaPrefix;
310 if (player_info.video_codec_name == "vp8") {
311 uma_name += "VP8.";
312 } else if (player_info.video_codec_name == "vp9") {
313 uma_name += "VP9.";
314 } else if (player_info.video_codec_name == "h264") {
315 uma_name += "H264.";
316 } else {
317 return uma_name + "Other";
318 }
319
320 if (player_info.video_decoder ==
321 media::DecryptingVideoDecoder::kDecoderName) {
322 return uma_name + "DVD";
323 }
324
325 if (player_info.video_dds) {
326 uma_name += "DDS.";
327 }
328
329 if (player_info.video_decoder == media::GpuVideoDecoder::kDecoderName) {
330 uma_name += "HW";
331 } else {
332 uma_name += "SW";
333 }
334 return uma_name;
335 }
336
296 void MediaInternals::MediaInternalsUMAHandler::ReportUMAForPipelineStatus( 337 void MediaInternals::MediaInternalsUMAHandler::ReportUMAForPipelineStatus(
297 const PipelineInfo& player_info) { 338 const PipelineInfo& player_info) {
298 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 339 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
299 if (player_info.has_video && player_info.has_audio) { 340 if (player_info.has_video && player_info.has_audio) {
300 if (player_info.video_codec_name == "vp8") { 341 base::LinearHistogram::FactoryGet(
301 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.AudioVideo.VP8.SW", 342 GetUMANameForAVStream(player_info), 1, media::PIPELINE_STATUS_MAX,
302 player_info.last_pipeline_status, 343 media::PIPELINE_STATUS_MAX + 1,
303 media::PIPELINE_STATUS_MAX + 1); 344 base::HistogramBase::kUmaTargetedHistogramFlag)
304 } else if (player_info.video_codec_name == "vp9") { 345 ->Add(player_info.last_pipeline_status);
305 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.AudioVideo.VP9.SW",
306 player_info.last_pipeline_status,
307 media::PIPELINE_STATUS_MAX + 1);
308 } else if (player_info.video_codec_name == "h264") {
309 if (player_info.video_decoder == media::GpuVideoDecoder::kDecoderName) {
310 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.AudioVideo.H264.HW",
311 player_info.last_pipeline_status,
312 media::PIPELINE_STATUS_MAX + 1);
313 } else {
314 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.AudioVideo.H264.SW",
315 player_info.last_pipeline_status,
316 media::PIPELINE_STATUS_MAX + 1);
317 }
318 } else {
319 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.AudioVideo.Other",
320 player_info.last_pipeline_status,
321 media::PIPELINE_STATUS_MAX + 1);
322 }
323 } else if (player_info.has_audio) { 346 } else if (player_info.has_audio) {
324 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.AudioOnly", 347 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.AudioOnly",
325 player_info.last_pipeline_status, 348 player_info.last_pipeline_status,
326 media::PIPELINE_STATUS_MAX + 1); 349 media::PIPELINE_STATUS_MAX + 1);
327 } else if (player_info.has_video) { 350 } else if (player_info.has_video) {
328 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.VideoOnly", 351 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.VideoOnly",
329 player_info.last_pipeline_status, 352 player_info.last_pipeline_status,
330 media::PIPELINE_STATUS_MAX + 1); 353 media::PIPELINE_STATUS_MAX + 1);
331 } else { 354 } else {
332 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.Unsupported", 355 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.Unsupported",
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 const std::string& function, 515 const std::string& function,
493 const base::DictionaryValue* value) { 516 const base::DictionaryValue* value) {
494 SendUpdate(SerializeUpdate(function, value)); 517 SendUpdate(SerializeUpdate(function, value));
495 518
496 base::AutoLock auto_lock(lock_); 519 base::AutoLock auto_lock(lock_);
497 scoped_ptr<base::Value> out_value; 520 scoped_ptr<base::Value> out_value;
498 CHECK(audio_streams_cached_data_.Remove(cache_key, &out_value)); 521 CHECK(audio_streams_cached_data_.Remove(cache_key, &out_value));
499 } 522 }
500 523
501 } // namespace content 524 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/filters/decrypting_video_decoder.h » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698