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

Unified Diff: content/renderer/media/android/stream_texture_wrapper_impl.cc

Issue 2556983002: Fix SetStreamTextureSize crash (Closed)
Patch Set: Addressed comments Created 4 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
Index: content/renderer/media/android/stream_texture_wrapper_impl.cc
diff --git a/content/renderer/media/android/stream_texture_wrapper_impl.cc b/content/renderer/media/android/stream_texture_wrapper_impl.cc
index 67ecb156140c3a4038aceda5e4f2a1a200bd7b62..036612f2dfdfff316fcaff8bf7be6142c765ccee 100644
--- a/content/renderer/media/android/stream_texture_wrapper_impl.cc
+++ b/content/renderer/media/android/stream_texture_wrapper_impl.cc
@@ -129,6 +129,10 @@ void StreamTextureWrapperImpl::UpdateTextureSize(const gfx::Size& new_size) {
return;
}
+ // InitializeOnMainThread() hasn't run, or failed.
+ if (!stream_texture_proxy_)
+ return;
+
if (natural_size_ == new_size)
return;
@@ -142,7 +146,7 @@ void StreamTextureWrapperImpl::Initialize(
const base::Closure& received_frame_cb,
const gfx::Size& natural_size,
scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
- const base::Closure& init_cb) {
+ const StreamTextureWrapperInitCB& init_cb) {
DVLOG(2) << __func__;
compositor_task_runner_ = compositor_task_runner;
@@ -156,24 +160,23 @@ void StreamTextureWrapperImpl::Initialize(
void StreamTextureWrapperImpl::InitializeOnMainThread(
const base::Closure& received_frame_cb,
- const base::Closure& init_cb) {
+ const StreamTextureWrapperInitCB& init_cb) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
DVLOG(2) << __func__;
stream_texture_proxy_ = factory_->CreateProxy(
kGLTextureExternalOES, &texture_id_, &texture_mailbox_);
- if (!stream_texture_proxy_)
+ if (!stream_texture_proxy_) {
+ init_cb.Run(false);
return;
+ }
ReallocateVideoFrame(natural_size_);
stream_texture_proxy_->BindToTaskRunner(received_frame_cb,
compositor_task_runner_);
- // TODO(tguilbert): Register the surface properly. See crbug.com/627658.
-
- // |init_cb| is bound to the thread that originally called Initialize().
- init_cb.Run();
+ init_cb.Run(true);
}
void StreamTextureWrapperImpl::Destroy() {
« no previous file with comments | « content/renderer/media/android/stream_texture_wrapper_impl.h ('k') | media/base/android/stream_texture_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698