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

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

Issue 2390783003: Make stream_id internal to StreamTextureHost. (Closed)
Patch Set: Rebasing to TOT. Created 4 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
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 0662a61ba91bb904fb6a92c2152ae99c27d3e4c5..829344d98460254745a2d47df962af6911f77a4f 100644
--- a/content/renderer/media/android/stream_texture_wrapper_impl.cc
+++ b/content/renderer/media/android/stream_texture_wrapper_impl.cc
@@ -33,7 +33,6 @@ StreamTextureWrapperImpl::StreamTextureWrapperImpl(
scoped_refptr<StreamTextureFactory> factory,
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner)
: texture_id_(0),
- stream_id_(0),
factory_(factory),
main_task_runner_(main_task_runner),
weak_factory_(this) {}
@@ -41,11 +40,12 @@ StreamTextureWrapperImpl::StreamTextureWrapperImpl(
StreamTextureWrapperImpl::~StreamTextureWrapperImpl() {
DCHECK(main_task_runner_->BelongsToCurrentThread());
- if (stream_id_) {
+ if (texture_id_) {
GLES2Interface* gl = factory_->ContextGL();
gl->DeleteTextures(1, &texture_id_);
// Flush to ensure that the stream texture gets deleted in a timely fashion.
gl->ShallowFlushCHROMIUM();
+ texture_id_ = 0;
liberato (no reviews please) 2016/10/07 20:01:26 why? (i have a habit of doing this too -- but i ha
sivag 2016/10/10 11:06:52 There is no reason to do it in the destructor. I w
}
SetCurrentFrameInternal(nullptr);
@@ -106,8 +106,7 @@ void StreamTextureWrapperImpl::ReallocateVideoFrame(
void StreamTextureWrapperImpl::ForwardStreamTextureForSurfaceRequest(
const base::UnguessableToken& request_token) {
- return factory_->ForwardStreamTextureForSurfaceRequest(stream_id_,
- request_token);
+ stream_texture_proxy_->ForwardStreamTextureForSurfaceRequest(request_token);
}
void StreamTextureWrapperImpl::SetCurrentFrameInternal(
@@ -132,7 +131,7 @@ void StreamTextureWrapperImpl::UpdateTextureSize(const gfx::Size& new_size) {
natural_size_ = new_size;
ReallocateVideoFrame(new_size);
- factory_->SetStreamTextureSize(stream_id_, new_size);
+ stream_texture_proxy_->SetStreamTextureSize(new_size);
}
void StreamTextureWrapperImpl::Initialize(
@@ -157,13 +156,13 @@ void StreamTextureWrapperImpl::InitializeOnMainThread(
DCHECK(main_task_runner_->BelongsToCurrentThread());
DVLOG(2) << __FUNCTION__;
- stream_texture_proxy_.reset(factory_->CreateProxy());
+ int32_t route_id = factory_->CreateStreamTexture(
+ kGLTextureExternalOES, &texture_id_, &texture_mailbox_);
+ stream_texture_proxy_.reset(factory_->CreateProxy(route_id));
- stream_id_ = factory_->CreateStreamTexture(kGLTextureExternalOES,
- &texture_id_, &texture_mailbox_);
ReallocateVideoFrame(natural_size_);
- stream_texture_proxy_->BindToTaskRunner(stream_id_, received_frame_cb,
+ stream_texture_proxy_->BindToTaskRunner(received_frame_cb,
compositor_task_runner_);
// TODO(tguilbert): Register the surface properly. See crbug.com/627658.

Powered by Google App Engine
This is Rietveld 408576698