Chromium Code Reviews| Index: media/base/android/media_statistics.h |
| diff --git a/media/base/android/media_statistics.h b/media/base/android/media_statistics.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e8279851826f8679906200b8045f886bbf7137b9 |
| --- /dev/null |
| +++ b/media/base/android/media_statistics.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ |
| +#define MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ |
| + |
| +#include <stdint.h> |
| +#include "base/time/time.h" |
| +#include "media/base/demuxer_stream.h" |
| + |
| +namespace media { |
| + |
| +// FrameStatistics struct deals with frames of one stream, i.e. either |
| +// audio or video. |
| +struct FrameStatistics { |
| + DemuxerStream::Type stream_type; |
| + uint32_t total; |
|
qinmin
2015/09/29 23:47:44
provide comments on these variables.
Tima Vaisburd
2015/09/30 18:50:10
Done.
|
| + uint32_t late; |
| + |
| + FrameStatistics(DemuxerStream::Type type) |
| + : stream_type(type), total(0), late(0) {} |
| + |
| + void Clear() { total = late = 0; } |
| + void AddFrame(); |
| + void AddLateFrame(base::TimeDelta delay); |
| +}; |
| + |
| +// MediaStatistics class gathers and reports playback quality statistics to UMA. |
| +// |
| +// This class is not thread safe. The caller should guarantee that operations |
| +// on FrameStatistics objects does not happen during Start() and |
| +// StopAndReport(). The Start() and StopAndReport() methods need to be called |
| +// sequantially. |
| + |
| +class MediaStatistics { |
| + public: |
| + MediaStatistics(); |
| + ~MediaStatistics(); |
| + |
| + FrameStatistics& AudioFrames() { return audio_frames_; } |
|
qinmin
2015/09/29 23:47:44
audio_frames();
Tima Vaisburd
2015/09/30 18:50:09
Done.
|
| + FrameStatistics& VideoFrames() { return video_frames_; } |
|
qinmin
2015/09/29 23:47:44
video_frames()
Tima Vaisburd
2015/09/30 18:50:10
Done.
|
| + void Start(); |
|
qinmin
2015/09/29 23:47:44
comments on member functions
Tima Vaisburd
2015/09/30 18:50:09
Done.
|
| + void AddStarvation(); |
| + void StopAndReport(); |
| + |
| + private: |
| + void Clear(); |
| + void Report(base::TimeDelta duration); |
| + |
| + base::TimeTicks start_time_; |
| + FrameStatistics audio_frames_; |
| + FrameStatistics video_frames_; |
| + uint32_t num_starvations_; |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_BASE_ANDROID_MEDIA_STATISTICS_H_ |