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

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

Issue 1537583002: Trigger MSE players UMA by user events only (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase only Created 5 years 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 | « no previous file | media/base/android/media_source_player.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/media_codec_player.cc
diff --git a/media/base/android/media_codec_player.cc b/media/base/android/media_codec_player.cc
index 1fb821d3b759d55609fd3ad3eb374ac6799d6a9a..6c15652dbd557e911d89bb63a7e65570e705c3c7 100644
--- a/media/base/android/media_codec_player.cc
+++ b/media/base/android/media_codec_player.cc
@@ -87,6 +87,8 @@ MediaCodecPlayer::~MediaCodecPlayer()
DVLOG(1) << "MediaCodecPlayer::~MediaCodecPlayer";
DCHECK(GetMediaTaskRunner()->BelongsToCurrentThread());
+ media_stat_->StopAndReport(GetInterpolatedTime());
+
// Currently the unit tests wait for the MediaCodecPlayer destruction by
// watching the demuxer, which is destroyed as one of the member variables.
// Release the codecs here, before any member variable is destroyed to make
@@ -97,8 +99,6 @@ MediaCodecPlayer::~MediaCodecPlayer()
if (audio_decoder_)
audio_decoder_->ReleaseDecoderResources();
- media_stat_->StopAndReport(GetInterpolatedTime());
-
if (cdm_) {
DCHECK(cdm_registration_id_);
static_cast<MediaDrmBridge*>(cdm_.get())
@@ -247,6 +247,8 @@ void MediaCodecPlayer::Pause(bool is_media_related_action) {
DVLOG(1) << __FUNCTION__;
+ media_stat_->StopAndReport(GetInterpolatedTime());
+
SetPendingStart(false);
switch (state_) {
@@ -279,6 +281,8 @@ void MediaCodecPlayer::SeekTo(base::TimeDelta timestamp) {
DVLOG(1) << __FUNCTION__ << " " << timestamp;
+ media_stat_->StopAndReport(GetInterpolatedTime());
+
switch (state_) {
case kStatePaused:
SetState(kStateWaitingForSeek);
@@ -329,6 +333,8 @@ void MediaCodecPlayer::Release() {
DVLOG(1) << __FUNCTION__;
+ media_stat_->StopAndReport(GetInterpolatedTime());
+
// Stop decoding threads and delete MediaCodecs, but keep IPC between browser
// and renderer processes going. Seek should work across and after Release().
@@ -822,13 +828,13 @@ void MediaCodecPlayer::OnStopDone(DemuxerStream::Type type) {
return;
}
- media_stat_->StopAndReport(GetInterpolatedTime());
-
// DetachListener to UI thread
ui_task_runner_->PostTask(FROM_HERE, detach_listener_cb_);
- if (AudioFinished() && VideoFinished())
+ if (AudioFinished() && VideoFinished()) {
+ media_stat_->StopAndReport(GetInterpolatedTime());
ui_task_runner_->PostTask(FROM_HERE, completion_cb_);
+ }
}
void MediaCodecPlayer::OnMissingKeyReported(DemuxerStream::Type type) {
@@ -839,6 +845,8 @@ void MediaCodecPlayer::OnMissingKeyReported(DemuxerStream::Type type) {
key_is_required_ = true;
if (state_ == kStatePlaying) {
+ media_stat_->StopAndReport(GetInterpolatedTime());
+
SetState(kStateStopping);
RequestToStopDecoders();
SetPendingStart(true);
@@ -849,6 +857,8 @@ void MediaCodecPlayer::OnError() {
DCHECK(GetMediaTaskRunner()->BelongsToCurrentThread());
DVLOG(1) << __FUNCTION__;
+ media_stat_->StopAndReport(GetInterpolatedTime());
+
// kStateError blocks all events
SetState(kStateError);
@@ -1243,7 +1253,6 @@ MediaCodecPlayer::StartStatus MediaCodecPlayer::StartDecoders() {
// At this point decoder threads are either not running at all or their
// message pumps are in the idle state after the preroll is done.
- media_stat_->Start(current_time);
if (!AudioFinished()) {
if (!audio_decoder_->Start(current_time))
@@ -1258,6 +1267,8 @@ MediaCodecPlayer::StartStatus MediaCodecPlayer::StartDecoders() {
return kStartFailed;
}
+ media_stat_->Start(current_time);
+
return kStartOk;
}
@@ -1267,8 +1278,6 @@ void MediaCodecPlayer::StopDecoders() {
video_decoder_->SyncStop();
audio_decoder_->SyncStop();
-
- media_stat_->StopAndReport(GetInterpolatedTime());
}
void MediaCodecPlayer::RequestToStopDecoders() {
@@ -1326,8 +1335,6 @@ void MediaCodecPlayer::ReleaseDecoderResources() {
// At this point decoder threads should not be running
if (interpolator_.interpolating())
interpolator_.StopInterpolating();
-
- media_stat_->StopAndReport(GetInterpolatedTime());
}
void MediaCodecPlayer::CreateDecoders() {
« no previous file with comments | « no previous file | media/base/android/media_source_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698