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

Unified Diff: content/renderer/media/android/webmediaplayer_android.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/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index feec4212bfc7871a51159822b1fff6282eea7ce0..ddfb37013c5afcd972e4f545290e5d5f2ac0b54f 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -151,7 +151,6 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid(
network_state_(WebMediaPlayer::NetworkStateEmpty),
ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
texture_id_(0),
- stream_id_(0),
is_player_initialized_(false),
is_playing_(false),
is_play_pending_(false),
@@ -200,14 +199,13 @@ WebMediaPlayerAndroid::~WebMediaPlayerAndroid() {
player_manager_->UnregisterMediaPlayer(player_id_);
- if (stream_id_) {
+ if (stream_texture_proxy_.get() && texture_id_) {
GLES2Interface* gl = stream_texture_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;
texture_mailbox_ = gpu::Mailbox();
- stream_id_ = 0;
}
{
@@ -808,8 +806,8 @@ void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) {
// For hidden video element (with style "display:none"), ensure the texture
// size is set.
if (!is_remote_ && cached_stream_texture_size_ != natural_size_) {
- stream_texture_factory_->SetStreamTextureSize(
- stream_id_, gfx::Size(natural_size_.width, natural_size_.height));
+ stream_texture_proxy_->SetStreamTextureSize(
+ gfx::Size(natural_size_.width, natural_size_.height));
cached_stream_texture_size_ = natural_size_;
}
@@ -1111,14 +1109,13 @@ void WebMediaPlayerAndroid::PutCurrentFrame() {
void WebMediaPlayerAndroid::RemoveSurfaceTextureAndProxy() {
DCHECK(main_thread_checker_.CalledOnValidThread());
- if (stream_id_) {
+ if (stream_texture_proxy_.get() && texture_id_) {
GLES2Interface* gl = stream_texture_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;
texture_mailbox_ = gpu::Mailbox();
- stream_id_ = 0;
}
stream_texture_proxy_.reset();
needs_establish_peer_ =
@@ -1140,7 +1137,7 @@ void WebMediaPlayerAndroid::UpdateStreamTextureProxyCallback(
base::Unretained(client));
}
- stream_texture_proxy_->BindToTaskRunner(stream_id_, frame_received_cb,
+ stream_texture_proxy_->BindToTaskRunner(frame_received_cb,
compositor_task_runner_);
}
@@ -1158,9 +1155,9 @@ void WebMediaPlayerAndroid::TryCreateStreamTextureProxyIfNeeded() {
if (!needs_establish_peer_)
return;
- stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy());
+ int32_t route_id = DoCreateStreamTexture();
liberato (no reviews please) 2016/10/07 20:01:26 can this fail?
sivag 2016/10/10 11:06:52 Done.
+ stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy(route_id));
liberato (no reviews please) 2016/10/07 20:01:26 perhaps this can be folded into DoCreateStreamText
sivag 2016/10/10 11:06:52 Done.
if (stream_texture_proxy_) {
- DoCreateStreamTexture();
ReallocateVideoFrame();
if (video_frame_provider_client_)
UpdateStreamTextureProxyCallback(video_frame_provider_client_);
@@ -1172,24 +1169,22 @@ void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() {
if (!stream_texture_proxy_)
return;
- if (stream_texture_factory_.get() && stream_id_)
- stream_texture_factory_->EstablishPeer(stream_id_, player_id_, frame_id_);
+ stream_texture_proxy_->EstablishPeer(player_id_, frame_id_);
// Set the deferred size because the size was changed in remote mode.
if (!is_remote_ && cached_stream_texture_size_ != natural_size_) {
- stream_texture_factory_->SetStreamTextureSize(
- stream_id_, gfx::Size(natural_size_.width, natural_size_.height));
+ stream_texture_proxy_->SetStreamTextureSize(
+ gfx::Size(natural_size_.width, natural_size_.height));
cached_stream_texture_size_ = natural_size_;
}
needs_establish_peer_ = false;
}
-void WebMediaPlayerAndroid::DoCreateStreamTexture() {
+int32_t WebMediaPlayerAndroid::DoCreateStreamTexture() {
DCHECK(main_thread_checker_.CalledOnValidThread());
- DCHECK(!stream_id_);
DCHECK(!texture_id_);
- stream_id_ = stream_texture_factory_->CreateStreamTexture(
+ return stream_texture_factory_->CreateStreamTexture(
kGLTextureExternalOES, &texture_id_, &texture_mailbox_);
}

Powered by Google App Engine
This is Rietveld 408576698