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

Side by Side Diff: media/base/android/media_player_bridge.cc

Issue 1398703003: Fix an issue that an invalid surface could be passed to MediaPlayerBridge (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/android/media_player_bridge.h" 5 #include "media/base/android/media_player_bridge.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 SetVolume(volume_); 102 SetVolume(volume_);
103 103
104 AttachListener(j_media_player_bridge_.obj()); 104 AttachListener(j_media_player_bridge_.obj());
105 } 105 }
106 106
107 void MediaPlayerBridge::SetDuration(base::TimeDelta duration) { 107 void MediaPlayerBridge::SetDuration(base::TimeDelta duration) {
108 duration_ = duration; 108 duration_ = duration;
109 } 109 }
110 110
111 void MediaPlayerBridge::SetVideoSurface(gfx::ScopedJavaSurface surface) { 111 void MediaPlayerBridge::SetVideoSurface(gfx::ScopedJavaSurface surface) {
112 if (j_media_player_bridge_.is_null()) { 112 surface_ = surface.IsValid() ? surface.Pass() : gfx::ScopedJavaSurface();
no sievers 2015/10/08 23:00:27 Should we just make ScopedJavaSurface::MoveFrom()
qinmin 2015/10/08 23:47:23 with the move-only type, the right hand side has t
113 if (!surface.IsEmpty()) 113
114 surface_ = surface.Pass(); 114 if (j_media_player_bridge_.is_null())
115 return; 115 return;
116 }
117 116
118 JNIEnv* env = base::android::AttachCurrentThread(); 117 JNIEnv* env = base::android::AttachCurrentThread();
119 CHECK(env); 118 CHECK(env);
120 119
121 Java_MediaPlayerBridge_setSurface( 120 Java_MediaPlayerBridge_setSurface(
122 env, j_media_player_bridge_.obj(), surface.j_surface().obj()); 121 env, j_media_player_bridge_.obj(), surface_.j_surface().obj());
123 } 122 }
124 123
125 void MediaPlayerBridge::Prepare() { 124 void MediaPlayerBridge::Prepare() {
126 DCHECK(j_media_player_bridge_.is_null()); 125 DCHECK(j_media_player_bridge_.is_null());
127 CreateJavaMediaPlayerBridge(); 126 CreateJavaMediaPlayerBridge();
128 if (url_.SchemeIsFileSystem() || url_.SchemeIsBlob()) { 127 if (url_.SchemeIsFileSystem() || url_.SchemeIsBlob()) {
129 manager()->GetMediaResourceGetter()->GetPlatformPathFromURL( 128 manager()->GetMediaResourceGetter()->GetPlatformPathFromURL(
130 url_, 129 url_,
131 base::Bind(&MediaPlayerBridge::SetDataSource, 130 base::Bind(&MediaPlayerBridge::SetDataSource,
132 weak_factory_.GetWeakPtr())); 131 weak_factory_.GetWeakPtr()));
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 527
529 GURL MediaPlayerBridge::GetUrl() { 528 GURL MediaPlayerBridge::GetUrl() {
530 return url_; 529 return url_;
531 } 530 }
532 531
533 GURL MediaPlayerBridge::GetFirstPartyForCookies() { 532 GURL MediaPlayerBridge::GetFirstPartyForCookies() {
534 return first_party_for_cookies_; 533 return first_party_for_cookies_;
535 } 534 }
536 535
537 } // namespace media 536 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | ui/gl/android/scoped_java_surface.h » ('j') | ui/gl/android/scoped_java_surface.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698