| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |