Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(869)

Unified Diff: media/base/android/media_codec_audio_decoder.cc

Issue 1367403003: Added UMA metrics for MediaSourcePlayer and MediaCodecPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtplayer-drm
Patch Set: Attempt to fix clang compilation Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/android/media_codec_audio_decoder.h ('k') | media/base/android/media_codec_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/media_codec_audio_decoder.cc
diff --git a/media/base/android/media_codec_audio_decoder.cc b/media/base/android/media_codec_audio_decoder.cc
index 503fb39223ccdd913707f459941f6698d5112eee..4b8a0768b82db34e51aeea8654c2585fd55c2da5 100644
--- a/media/base/android/media_codec_audio_decoder.cc
+++ b/media/base/android/media_codec_audio_decoder.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "media/base/android/media_codec_bridge.h"
+#include "media/base/android/media_statistics.h"
#include "media/base/audio_timestamp_helper.h"
#include "media/base/demuxer_stream.h"
@@ -21,6 +22,7 @@ namespace media {
MediaCodecAudioDecoder::MediaCodecAudioDecoder(
const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
+ FrameStatistics* frame_statistics,
const base::Closure& request_data_cb,
const base::Closure& starvation_cb,
const base::Closure& decoder_drained_cb,
@@ -28,14 +30,15 @@ MediaCodecAudioDecoder::MediaCodecAudioDecoder(
const base::Closure& waiting_for_decryption_key_cb,
const base::Closure& error_cb,
const SetTimeCallback& update_current_time_cb)
- : MediaCodecDecoder(media_task_runner,
+ : MediaCodecDecoder("AudioDecoder",
+ media_task_runner,
+ frame_statistics,
request_data_cb,
starvation_cb,
decoder_drained_cb,
stop_done_cb,
waiting_for_decryption_key_cb,
- error_cb,
- "AudioDecoder"),
+ error_cb),
volume_(-1.0),
bytes_per_frame_(0),
output_sampling_rate_(0),
@@ -207,6 +210,10 @@ void MediaCodecAudioDecoder::Render(int buffer_index,
int64 head_position =
audio_codec->PlayOutputBuffer(buffer_index, size, offset, postpone);
+ base::TimeTicks current_time = base::TimeTicks::Now();
+
+ frame_statistics_->IncrementFrameCount();
+
// Reset the base timestamp if we have not started playing.
// SetBaseTimestamp() must be called before AddFrames() since it resets the
// internal frame count.
@@ -240,6 +247,16 @@ void MediaCodecAudioDecoder::Render(int buffer_index,
DVLOG(2) << class_name() << "::" << __FUNCTION__ << " pts:" << pts
<< " will play: [" << now_playing << "," << last_buffered << "]";
+ // Statistics
+ if (!next_frame_time_limit_.is_null() &&
+ next_frame_time_limit_ < current_time) {
+ DVLOG(2) << class_name() << "::" << __FUNCTION__ << " LATE FRAME delay:"
+ << current_time - next_frame_time_limit_;
+ frame_statistics_->IncrementLateFrameCount();
+ }
+
+ next_frame_time_limit_ = current_time + (last_buffered - now_playing);
+
media_task_runner_->PostTask(
FROM_HERE, base::Bind(update_current_time_cb_, now_playing,
last_buffered, false));
« no previous file with comments | « media/base/android/media_codec_audio_decoder.h ('k') | media/base/android/media_codec_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698