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

Side by Side Diff: media/base/android/media_statistics.cc

Issue 1458783002: Fix UMA metrics for MediaSourcePlayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed bug when current time is unknown Created 5 years, 1 month 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 | « media/base/android/media_source_player.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "media/base/android/media_statistics.h" 5 #include "media/base/android/media_statistics.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "media/base/android/demuxer_stream_player_params.h" 9 #include "media/base/android/demuxer_stream_player_params.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 start_time_ = current_playback_time; 46 start_time_ = current_playback_time;
47 } 47 }
48 } 48 }
49 49
50 void MediaStatistics::StopAndReport(base::TimeDelta current_playback_time) { 50 void MediaStatistics::StopAndReport(base::TimeDelta current_playback_time) {
51 DVLOG(1) << __FUNCTION__; 51 DVLOG(1) << __FUNCTION__;
52 52
53 if (start_time_ == kNoTimestamp()) 53 if (start_time_ == kNoTimestamp())
54 return; // skip if there was no prior Start(). 54 return; // skip if there was no prior Start().
55 55
56 if (current_playback_time == kNoTimestamp()) {
57 // Cancel the start event and skip if current time is unknown.
58 start_time_ = kNoTimestamp();
59 return;
60 }
61
56 base::TimeDelta duration = current_playback_time - start_time_; 62 base::TimeDelta duration = current_playback_time - start_time_;
57 63
58 // Reset start time. 64 // Reset start time.
59 start_time_ = kNoTimestamp(); 65 start_time_ = kNoTimestamp();
60 66
61 if (duration < base::TimeDelta::FromSeconds(kMinDurationInSeconds)) 67 if (duration < base::TimeDelta::FromSeconds(kMinDurationInSeconds))
62 return; // duration is too short. 68 return; // duration is too short.
63 69
64 if (duration > base::TimeDelta::FromSeconds(kMaxDurationInSeconds)) 70 if (duration > base::TimeDelta::FromSeconds(kMaxDurationInSeconds))
65 return; // duration is too long. 71 return; // duration is too long.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 116
111 uint32_t total_frames = audio_frame_stats_.total ? audio_frame_stats_.total 117 uint32_t total_frames = audio_frame_stats_.total ? audio_frame_stats_.total
112 : video_frame_stats_.total; 118 : video_frame_stats_.total;
113 if (total_frames) { 119 if (total_frames) {
114 UMA_HISTOGRAM_COUNTS("Media.MSE.Starvations", 120 UMA_HISTOGRAM_COUNTS("Media.MSE.Starvations",
115 kOneMillion * num_starvations_ / total_frames); 121 kOneMillion * num_starvations_ / total_frames);
116 } 122 }
117 } 123 }
118 124
119 } // namespace media 125 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_source_player.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698