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

Unified Diff: media/base/android/media_codec_video_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: Addressed most of the comments 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
Index: media/base/android/media_codec_video_decoder.cc
diff --git a/media/base/android/media_codec_video_decoder.cc b/media/base/android/media_codec_video_decoder.cc
index 70d477d7d5b701af186887ee89f8b90ea884cbac..87736d845602247ade32488d3c8f0d977af3dd09 100644
--- a/media/base/android/media_codec_video_decoder.cc
+++ b/media/base/android/media_codec_video_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/demuxer_stream.h"
#include "media/base/timestamp_constants.h"
@@ -26,7 +27,8 @@ MediaCodecVideoDecoder::MediaCodecVideoDecoder(
const base::Closure& error_cb,
const SetTimeCallback& update_current_time_cb,
const VideoSizeChangedCallback& video_size_changed_cb,
- const base::Closure& codec_created_cb)
+ const base::Closure& codec_created_cb,
+ FrameStatistics* frame_statistics)
: MediaCodecDecoder(media_task_runner,
request_data_cb,
starvation_cb,
@@ -34,7 +36,8 @@ MediaCodecVideoDecoder::MediaCodecVideoDecoder(
stop_done_cb,
key_required_cb,
error_cb,
- "VideoDecoder"),
+ "VideoDecoder",
+ frame_statistics),
is_protected_surface_required_(false),
update_current_time_cb_(update_current_time_cb),
video_size_changed_cb_(video_size_changed_cb),
@@ -274,7 +277,15 @@ void MediaCodecVideoDecoder::Render(int buffer_index,
<< " ticks delta:" << (base::TimeTicks::Now() - start_time_ticks_)
<< " time_to_render:" << time_to_render;
+ const bool render = (size > 0);
+
+ if (render && frame_statistics_)
+ frame_statistics_->AddFrame();
+
if (time_to_render < base::TimeDelta()) {
+ if (render && frame_statistics_)
+ frame_statistics_->AddLateFrame((-1) * time_to_render);
+
// Skip late frames
ReleaseOutputBuffer(buffer_index, pts, false, update_time, eos_encountered);
return;
@@ -282,7 +293,6 @@ void MediaCodecVideoDecoder::Render(int buffer_index,
delayed_buffers_.insert(buffer_index);
- const bool render = (size > 0);
decoder_thread_.task_runner()->PostDelayedTask(
FROM_HERE, base::Bind(&MediaCodecVideoDecoder::ReleaseOutputBuffer,
base::Unretained(this), buffer_index, pts, render,

Powered by Google App Engine
This is Rietveld 408576698