OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ | |
6 #define MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ | |
7 | |
8 #include <stdint.h> | |
9 #include "base/time/time.h" | |
10 #include "media/base/demuxer_stream.h" | |
11 | |
12 namespace media { | |
13 | |
14 // FrameStatistics struct deals with frames of one stream, i.e. either | |
15 // audio or video. | |
16 struct FrameStatistics { | |
17 DemuxerStream::Type stream_type; | |
18 uint32_t total; | |
qinmin
2015/09/29 23:47:44
provide comments on these variables.
Tima Vaisburd
2015/09/30 18:50:10
Done.
| |
19 uint32_t late; | |
20 | |
21 FrameStatistics(DemuxerStream::Type type) | |
22 : stream_type(type), total(0), late(0) {} | |
23 | |
24 void Clear() { total = late = 0; } | |
25 void AddFrame(); | |
26 void AddLateFrame(base::TimeDelta delay); | |
27 }; | |
28 | |
29 // MediaStatistics class gathers and reports playback quality statistics to UMA. | |
30 // | |
31 // This class is not thread safe. The caller should guarantee that operations | |
32 // on FrameStatistics objects does not happen during Start() and | |
33 // StopAndReport(). The Start() and StopAndReport() methods need to be called | |
34 // sequantially. | |
35 | |
36 class MediaStatistics { | |
37 public: | |
38 MediaStatistics(); | |
39 ~MediaStatistics(); | |
40 | |
41 FrameStatistics& AudioFrames() { return audio_frames_; } | |
qinmin
2015/09/29 23:47:44
audio_frames();
Tima Vaisburd
2015/09/30 18:50:09
Done.
| |
42 FrameStatistics& VideoFrames() { return video_frames_; } | |
qinmin
2015/09/29 23:47:44
video_frames()
Tima Vaisburd
2015/09/30 18:50:10
Done.
| |
43 void Start(); | |
qinmin
2015/09/29 23:47:44
comments on member functions
Tima Vaisburd
2015/09/30 18:50:09
Done.
| |
44 void AddStarvation(); | |
45 void StopAndReport(); | |
46 | |
47 private: | |
48 void Clear(); | |
49 void Report(base::TimeDelta duration); | |
50 | |
51 base::TimeTicks start_time_; | |
52 FrameStatistics audio_frames_; | |
53 FrameStatistics video_frames_; | |
54 uint32_t num_starvations_; | |
55 }; | |
56 | |
57 } // namespace media | |
58 | |
59 #endif // MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ | |
OLD | NEW |