summaryrefslogtreecommitdiffstats
path: root/content/browser/media
diff options
context:
space:
mode:
authorzqzhang <zqzhang@chromium.org>2016-02-16 10:41:14 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-16 18:42:53 +0000
commitc8bf96d3ef57c5b2cca865026c9d438d44ad47b7 (patch)
treeaf786cb0cdff58a5e302fcd3a2386f756236ae91 /content/browser/media
parent380137e05ade4859592fca5d281550d0688cbd6a (diff)
downloadchromium_src-c8bf96d3ef57c5b2cca865026c9d438d44ad47b7.zip
chromium_src-c8bf96d3ef57c5b2cca865026c9d438d44ad47b7.tar.gz
chromium_src-c8bf96d3ef57c5b2cca865026c9d438d44ad47b7.tar.bz2
[MediaSession] Record when media session ducks
We now lower the volume instead of suspend the media session when we receiving AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK. However we still want to record the event in the UMA. BUG=580494 Review URL: https://codereview.chromium.org/1685183002 Cr-Commit-Position: refs/heads/master@{#375612}
Diffstat (limited to 'content/browser/media')
-rw-r--r--content/browser/media/android/media_session.cc6
-rw-r--r--content/browser/media/android/media_session.h5
-rw-r--r--content/browser/media/android/media_session_uma_helper.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/content/browser/media/android/media_session.cc b/content/browser/media/android/media_session.cc
index e90daf4..1732105 100644
--- a/content/browser/media/android/media_session.cc
+++ b/content/browser/media/android/media_session.cc
@@ -136,6 +136,12 @@ void MediaSession::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) {
OnResumeInternal(SuspendType::SYSTEM);
}
+void MediaSession::RecordSessionDuck(JNIEnv* env,
+ const JavaParamRef<jobject>& obj) {
+ uma_helper_.RecordSessionSuspended(
+ MediaSessionSuspendedSource::SystemTransientDuck);
+}
+
void MediaSession::OnPlayerPaused(MediaSessionObserver* observer,
int player_id) {
// If a playback is completed, BrowserMediaPlayerManager will call
diff --git a/content/browser/media/android/media_session.h b/content/browser/media/android/media_session.h
index b0a1157..1271124 100644
--- a/content/browser/media/android/media_session.h
+++ b/content/browser/media/android/media_session.h
@@ -77,6 +77,11 @@ class CONTENT_EXPORT MediaSession
// Called by Java through JNI.
void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
+ // Called when the Android system requests the MediaSession to duck.
+ // Called by Java through JNI.
+ void RecordSessionDuck(JNIEnv* env,
+ const base::android::JavaParamRef<jobject> &obj);
+
// Called when a player is paused in the content.
// If the paused player is the last player, we suspend the MediaSession.
// Otherwise, the paused player will be removed from the MediaSession.
diff --git a/content/browser/media/android/media_session_uma_helper.h b/content/browser/media/android/media_session_uma_helper.h
index 69fbaa9..1fcf6b5 100644
--- a/content/browser/media/android/media_session_uma_helper.h
+++ b/content/browser/media/android/media_session_uma_helper.h
@@ -24,6 +24,7 @@ class CONTENT_EXPORT MediaSessionUmaHelper {
SystemPermanent = 1,
UI = 2,
CONTENT = 3,
+ SystemTransientDuck = 4,
Count // Leave at the end.
};