| 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 #ifndef MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "media/base/demuxer_stream.h" | 10 #include "media/base/demuxer_stream.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 public: | 50 public: |
| 51 MediaStatistics(); | 51 MediaStatistics(); |
| 52 ~MediaStatistics(); | 52 ~MediaStatistics(); |
| 53 | 53 |
| 54 // Returns the frame statistics for audio frames. | 54 // Returns the frame statistics for audio frames. |
| 55 FrameStatistics& audio_frame_stats() { return audio_frame_stats_; } | 55 FrameStatistics& audio_frame_stats() { return audio_frame_stats_; } |
| 56 | 56 |
| 57 // Returns the frame statistics for video frames. | 57 // Returns the frame statistics for video frames. |
| 58 FrameStatistics& video_frame_stats() { return video_frame_stats_; } | 58 FrameStatistics& video_frame_stats() { return video_frame_stats_; } |
| 59 | 59 |
| 60 // Starts gathering statistics. When called in a row only the firts call will | 60 // Starts gathering statistics. When called in a row only the first call will |
| 61 // take effect. | 61 // take effect. |
| 62 void Start(base::TimeDelta current_playback_time); | 62 void Start(base::TimeDelta current_playback_time); |
| 63 | 63 |
| 64 // Stops gathering statistics, calculate and report results. When called | 64 // Stops gathering statistics, calculate and report results. When called |
| 65 // in a row only the firts call will take effect. | 65 // in a row only the first call will take effect. |
| 66 void StopAndReport(base::TimeDelta current_playback_time); | 66 void StopAndReport(base::TimeDelta current_playback_time); |
| 67 | 67 |
| 68 // Adds starvation event. Starvation happens when the player interrupts | 68 // Adds starvation event. Starvation happens when the player interrupts |
| 69 // the regular playback and asks for more data. | 69 // the regular playback and asks for more data. |
| 70 void AddStarvation() { ++num_starvations_; } | 70 void AddStarvation() { ++num_starvations_; } |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 // Resets the data to the initial state. | 73 // Resets the data to the initial state. |
| 74 void Clear(); | 74 void Clear(); |
| 75 | 75 |
| 76 // Calculates relative data based on total frame numbers and reports it and | 76 // Calculates relative data based on total frame numbers and reports it and |
| 77 // the duration to UMA. | 77 // the duration to UMA. |
| 78 void Report(base::TimeDelta duration); | 78 void Report(base::TimeDelta duration); |
| 79 | 79 |
| 80 base::TimeDelta start_time_ = kNoTimestamp(); | 80 base::TimeDelta start_time_ = kNoTimestamp(); |
| 81 FrameStatistics audio_frame_stats_; | 81 FrameStatistics audio_frame_stats_; |
| 82 FrameStatistics video_frame_stats_; | 82 FrameStatistics video_frame_stats_; |
| 83 uint32_t num_starvations_ = 0; | 83 uint32_t num_starvations_ = 0; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace media | 86 } // namespace media |
| 87 | 87 |
| 88 #endif // MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ | 88 #endif // MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ |
| OLD | NEW |