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

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

Issue 847223002: Add a histogram for video decoder fallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Report from media internals instead. Created 5 years, 11 months 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Helper function to save the event payload to RendererPlayerMap. 193 // Helper function to save the event payload to RendererPlayerMap.
194 void SavePlayerState(const media::MediaLogEvent& event, 194 void SavePlayerState(const media::MediaLogEvent& event,
195 int render_process_id); 195 int render_process_id);
196 196
197 private: 197 private:
198 struct PipelineInfo { 198 struct PipelineInfo {
199 media::PipelineStatus last_pipeline_status; 199 media::PipelineStatus last_pipeline_status;
200 bool has_audio; 200 bool has_audio;
201 bool has_video; 201 bool has_video;
202 bool video_dds; 202 bool video_dds;
203 bool video_decoder_changed;
203 std::string audio_codec_name; 204 std::string audio_codec_name;
204 std::string video_codec_name; 205 std::string video_codec_name;
205 std::string video_decoder; 206 std::string video_decoder;
206 PipelineInfo() 207 PipelineInfo()
207 : last_pipeline_status(media::PIPELINE_OK), 208 : last_pipeline_status(media::PIPELINE_OK),
208 has_audio(false), 209 has_audio(false),
209 has_video(false), 210 has_video(false),
210 video_dds(false) {} 211 video_dds(false),
212 video_decoder_changed(false) {}
211 }; 213 };
212 214
213 // Helper function to report PipelineStatus associated with a player to UMA. 215 // Helper function to report PipelineStatus associated with a player to UMA.
214 void ReportUMAForPipelineStatus(const PipelineInfo& player_info); 216 void ReportUMAForPipelineStatus(const PipelineInfo& player_info);
215 217
216 // Helper to generate PipelineStatus UMA name for AudioVideo streams. 218 // Helper to generate PipelineStatus UMA name for AudioVideo streams.
217 std::string GetUMANameForAVStream(const PipelineInfo& player_info); 219 std::string GetUMANameForAVStream(const PipelineInfo& player_info);
218 220
219 // Key is playerid 221 // Key is playerid
220 typedef std::map<int, PipelineInfo> PlayerInfoMap; 222 typedef std::map<int, PipelineInfo> PlayerInfoMap;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 base::Bind(&MediaInternalsUMAHandler::LogAndClearPlayersInRenderer, 255 base::Bind(&MediaInternalsUMAHandler::LogAndClearPlayersInRenderer,
254 base::Unretained(this), process->GetID())); 256 base::Unretained(this), process->GetID()));
255 } 257 }
256 258
257 void MediaInternals::MediaInternalsUMAHandler::SavePlayerState( 259 void MediaInternals::MediaInternalsUMAHandler::SavePlayerState(
258 const media::MediaLogEvent& event, 260 const media::MediaLogEvent& event,
259 int render_process_id) { 261 int render_process_id) {
260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
261 PlayerInfoMap& player_info = renderer_info_[render_process_id]; 263 PlayerInfoMap& player_info = renderer_info_[render_process_id];
262 switch (event.type) { 264 switch (event.type) {
263 case media::MediaLogEvent::WEBMEDIAPLAYER_CREATED: {
264 // Nothing to do here
265 break;
266 }
267 case media::MediaLogEvent::PIPELINE_ERROR: { 265 case media::MediaLogEvent::PIPELINE_ERROR: {
268 int status; 266 int status;
269 event.params.GetInteger("pipeline_error", &status); 267 event.params.GetInteger("pipeline_error", &status);
270 player_info[event.id].last_pipeline_status = 268 player_info[event.id].last_pipeline_status =
271 static_cast<media::PipelineStatus>(status); 269 static_cast<media::PipelineStatus>(status);
272 break; 270 break;
273 } 271 }
274 case media::MediaLogEvent::PROPERTY_CHANGE: 272 case media::MediaLogEvent::PROPERTY_CHANGE:
275 if (event.params.HasKey("found_audio_stream")) { 273 if (event.params.HasKey("found_audio_stream")) {
276 event.params.GetBoolean("found_audio_stream", 274 event.params.GetBoolean("found_audio_stream",
277 &player_info[event.id].has_audio); 275 &player_info[event.id].has_audio);
278 } 276 }
279 if (event.params.HasKey("found_video_stream")) { 277 if (event.params.HasKey("found_video_stream")) {
280 event.params.GetBoolean("found_video_stream", 278 event.params.GetBoolean("found_video_stream",
281 &player_info[event.id].has_video); 279 &player_info[event.id].has_video);
282 } 280 }
283 if (event.params.HasKey("audio_codec_name")) { 281 if (event.params.HasKey("audio_codec_name")) {
284 event.params.GetString("audio_codec_name", 282 event.params.GetString("audio_codec_name",
285 &player_info[event.id].audio_codec_name); 283 &player_info[event.id].audio_codec_name);
286 } 284 }
287 if (event.params.HasKey("video_codec_name")) { 285 if (event.params.HasKey("video_codec_name")) {
288 event.params.GetString("video_codec_name", 286 event.params.GetString("video_codec_name",
289 &player_info[event.id].video_codec_name); 287 &player_info[event.id].video_codec_name);
290 } 288 }
291 if (event.params.HasKey("video_decoder")) { 289 if (event.params.HasKey("video_decoder")) {
290 std::string previous_video_decoder(player_info[event.id].video_decoder);
292 event.params.GetString("video_decoder", 291 event.params.GetString("video_decoder",
293 &player_info[event.id].video_decoder); 292 &player_info[event.id].video_decoder);
293 if (!previous_video_decoder.empty() &&
294 previous_video_decoder != player_info[event.id].video_decoder) {
295 player_info[event.id].video_decoder_changed = true;
296 }
294 } 297 }
295 if (event.params.HasKey("video_dds")) { 298 if (event.params.HasKey("video_dds")) {
296 event.params.GetBoolean("video_dds", &player_info[event.id].video_dds); 299 event.params.GetBoolean("video_dds", &player_info[event.id].video_dds);
297 } 300 }
298 break; 301 break;
299 default: 302 default:
300 break; 303 break;
301 } 304 }
302 return; 305 return;
303 } 306 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 media::PIPELINE_STATUS_MAX + 1); 352 media::PIPELINE_STATUS_MAX + 1);
350 } else if (player_info.has_video) { 353 } else if (player_info.has_video) {
351 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.VideoOnly", 354 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.VideoOnly",
352 player_info.last_pipeline_status, 355 player_info.last_pipeline_status,
353 media::PIPELINE_STATUS_MAX + 1); 356 media::PIPELINE_STATUS_MAX + 1);
354 } else { 357 } else {
355 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.Unsupported", 358 UMA_HISTOGRAM_ENUMERATION("Media.PipelineStatus.Unsupported",
356 player_info.last_pipeline_status, 359 player_info.last_pipeline_status,
357 media::PIPELINE_STATUS_MAX + 1); 360 media::PIPELINE_STATUS_MAX + 1);
358 } 361 }
362 // Report whether video decoder fallback happened, but only if a video decoder
363 // was reported.
364 if (!player_info.video_decoder.empty()) {
365 UMA_HISTOGRAM_BOOLEAN("Media.VideoDecoderFallback",
366 player_info.video_decoder_changed);
367 }
359 } 368 }
360 369
361 void MediaInternals::MediaInternalsUMAHandler::LogAndClearPlayersInRenderer( 370 void MediaInternals::MediaInternalsUMAHandler::LogAndClearPlayersInRenderer(
362 int render_process_id) { 371 int render_process_id) {
363 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 372 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
364 auto players_it = renderer_info_.find(render_process_id); 373 auto players_it = renderer_info_.find(render_process_id);
365 if (players_it == renderer_info_.end()) 374 if (players_it == renderer_info_.end())
366 return; 375 return;
367 auto it = players_it->second.begin(); 376 auto it = players_it->second.begin();
368 while (it != players_it->second.end()) { 377 while (it != players_it->second.end()) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 const std::string& function, 524 const std::string& function,
516 const base::DictionaryValue* value) { 525 const base::DictionaryValue* value) {
517 SendUpdate(SerializeUpdate(function, value)); 526 SendUpdate(SerializeUpdate(function, value));
518 527
519 base::AutoLock auto_lock(lock_); 528 base::AutoLock auto_lock(lock_);
520 scoped_ptr<base::Value> out_value; 529 scoped_ptr<base::Value> out_value;
521 CHECK(audio_streams_cached_data_.Remove(cache_key, &out_value)); 530 CHECK(audio_streams_cached_data_.Remove(cache_key, &out_value));
522 } 531 }
523 532
524 } // namespace content 533 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698