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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/MediaThrottler.java

Issue 1414603008: Catch IllegalStateException when creating the watchdog player (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/MediaThrottler.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/MediaThrottler.java b/content/public/android/java/src/org/chromium/content/browser/MediaThrottler.java
index 1895d6e1aa96ba70bb6bfb8bedf1d703e54bff6d..9992704b8715a703656c89d025a32896eeeb9b61 100644
--- a/content/public/android/java/src/org/chromium/content/browser/MediaThrottler.java
+++ b/content/public/android/java/src/org/chromium/content/browser/MediaThrottler.java
@@ -103,7 +103,11 @@ class MediaThrottler implements MediaPlayer.OnErrorListener {
protected Void doInBackground(Void... voids) {
synchronized (mLock) {
if (mPlayer != null || mRequestCount == 0) return null;
- mPlayer = MediaPlayer.create(mContext, R.raw.empty);
+ try {
Tima Vaisburd 2015/10/30 21:54:37 drive-by: The documentation does not seem to tell
qinmin 2015/10/30 21:58:16 if u check MediaPlayer.create(), it already catche
+ mPlayer = MediaPlayer.create(mContext, R.raw.empty);
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "Exception happens while creating the watch dog player.", e);
+ }
if (mPlayer == null) {
Log.e(TAG, "Unable to create watch dog player, treat it as server crash.");
onMediaServerCrash();
@@ -131,7 +135,7 @@ class MediaThrottler implements MediaPlayer.OnErrorListener {
return false;
}
mRequestCount++;
- if (mRequestCount == 1) {
+ if (mRequestCount == 1 || mPlayer == null) {
mHandler.removeCallbacks(mDelayedReleaseRunnable);
mHandler.post(new Runnable() {
@Override
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698