| OLD | NEW |
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 if (start_time_ == kNoTimestamp()) { | 44 if (start_time_ == kNoTimestamp()) { |
| 45 Clear(); | 45 Clear(); |
| 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() || current_playback_time == kNoTimestamp()) |
| 54 return; // skip if there was no prior Start(). | 54 return; // skip if there was no prior Start() or current time is wrong. |
| 55 | 55 |
| 56 base::TimeDelta duration = current_playback_time - start_time_; | 56 base::TimeDelta duration = current_playback_time - start_time_; |
| 57 | 57 |
| 58 // Reset start time. | 58 // Reset start time. |
| 59 start_time_ = kNoTimestamp(); | 59 start_time_ = kNoTimestamp(); |
| 60 | 60 |
| 61 if (duration < base::TimeDelta::FromSeconds(kMinDurationInSeconds)) | 61 if (duration < base::TimeDelta::FromSeconds(kMinDurationInSeconds)) |
| 62 return; // duration is too short. | 62 return; // duration is too short. |
| 63 | 63 |
| 64 if (duration > base::TimeDelta::FromSeconds(kMaxDurationInSeconds)) | 64 if (duration > base::TimeDelta::FromSeconds(kMaxDurationInSeconds)) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 uint32_t total_frames = audio_frame_stats_.total ? audio_frame_stats_.total | 111 uint32_t total_frames = audio_frame_stats_.total ? audio_frame_stats_.total |
| 112 : video_frame_stats_.total; | 112 : video_frame_stats_.total; |
| 113 if (total_frames) { | 113 if (total_frames) { |
| 114 UMA_HISTOGRAM_COUNTS("Media.MSE.Starvations", | 114 UMA_HISTOGRAM_COUNTS("Media.MSE.Starvations", |
| 115 kOneMillion * num_starvations_ / total_frames); | 115 kOneMillion * num_starvations_ / total_frames); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace media | 119 } // namespace media |
| OLD | NEW |