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

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

Issue 74293002: Fix browser crash when calling MediaPlayerBridge::PrepareAsync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/java/src/org/chromium/media/MediaPlayerBridge.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/media_player_bridge.cc
diff --git a/media/base/android/media_player_bridge.cc b/media/base/android/media_player_bridge.cc
index 435363d9d7764e70042eea871856022fdbc48bf9..25608af991810cde3c488b3836c588ac0c234a10 100644
--- a/media/base/android/media_player_bridge.cc
+++ b/media/base/android/media_player_bridge.cc
@@ -118,8 +118,8 @@ void MediaPlayerBridge::SetVideoSurface(gfx::ScopedJavaSurface surface) {
}
void MediaPlayerBridge::Prepare() {
- if (j_media_player_bridge_.is_null())
- CreateJavaMediaPlayerBridge();
+ DCHECK(j_media_player_bridge_.is_null());
+ CreateJavaMediaPlayerBridge();
if (url_.SchemeIsFileSystem()) {
manager()->GetMediaResourceGetter()->GetPlatformPathFromFileSystemURL(
url_, base::Bind(&MediaPlayerBridge::SetDataSource,
@@ -144,15 +144,17 @@ void MediaPlayerBridge::SetDataSource(const std::string& url) {
jobject j_context = base::android::GetApplicationContext();
DCHECK(j_context);
+ bool success = false;
if (Java_MediaPlayerBridge_setDataSource(
scherkus (not reviewing) 2013/11/15 23:14:05 I'd flip this around to use early returns if (!Ja
qinmin 2013/11/16 00:00:19 Done.
env, j_media_player_bridge_.obj(), j_context, j_url_string.obj(),
j_cookies.obj(), hide_url_log_)) {
manager()->RequestMediaResources(player_id());
scherkus (not reviewing) 2013/11/15 23:14:05 do we need to call ReleaseMediaResources() if prep
qinmin 2013/11/16 00:00:19 No, we shouldn't. The java MediaPlayer instance s
- Java_MediaPlayerBridge_prepareAsync(
+ success = Java_MediaPlayerBridge_prepareAsync(
env, j_media_player_bridge_.obj());
- } else {
- OnMediaError(MEDIA_ERROR_FORMAT);
}
+
+ if (!success)
+ OnMediaError(MEDIA_ERROR_FORMAT);
}
void MediaPlayerBridge::OnCookiesRetrieved(const std::string& cookies) {
« no previous file with comments | « media/base/android/java/src/org/chromium/media/MediaPlayerBridge.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698