Chromium Code Reviews| 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 cddec41d3d2c34502f88734081ea88c859cc64a2..4e865bcd5d7d0055fff5be37973e162434d2ede5 100644 |
| --- a/content/renderer/media/android/webmediaplayer_android.cc |
| +++ b/content/renderer/media/android/webmediaplayer_android.cc |
| @@ -96,6 +96,7 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid( |
| client_(client), |
| delegate_(delegate), |
| buffered_(static_cast<size_t>(1)), |
| + main_loop_(base::MessageLoopProxy::current()), |
| media_loop_(media_loop), |
| ignore_metadata_duration_change_(false), |
| pending_seek_(false), |
| @@ -1031,6 +1032,7 @@ void WebMediaPlayerAndroid::DrawRemotePlaybackText( |
| } |
| void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
| + DCHECK(main_thread_checker_.CalledOnValidThread()); |
| if (needs_external_surface_) { |
| // VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE. |
| #if defined(VIDEO_HOLE) |
| @@ -1047,6 +1049,7 @@ void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
| } else if (!is_remote_ && texture_id_) { |
| GLES2Interface* gl = stream_texture_factory_->ContextGL(); |
| GLuint texture_id_ref = 0; |
| + // FIXME: reuse texture pool like gpu_video_decoder. |
|
dshwang
2014/06/03 15:39:40
Currently every frame create new texture. We can a
|
| gl->GenTextures(1, &texture_id_ref); |
| GLuint texture_target = kGLTextureExternalOES; |
| gl->BindTexture(texture_target, texture_id_ref); |
| @@ -1109,6 +1112,13 @@ scoped_refptr<media::VideoFrame> WebMediaPlayerAndroid::GetCurrentFrame() { |
| void WebMediaPlayerAndroid::PutCurrentFrame( |
| const scoped_refptr<media::VideoFrame>& frame) { |
| + // Create new VideoFrame when a client return the previous frame. |
| + DCHECK(!main_thread_checker_.CalledOnValidThread()); |
| + // FIXME: instead of here, VideoFrameProvider::Client::DidReceiveFrame() can |
| + // handle it. |
|
dshwang
2014/06/03 15:39:40
I use PutCurrentFrame() as the end of each frame,
|
| + main_loop_->PostTask(FROM_HERE, |
| + base::Bind(&WebMediaPlayerAndroid::ReallocateVideoFrame, |
| + weak_factory_.GetWeakPtr())); |
| } |
| void WebMediaPlayerAndroid::TryCreateStreamTextureProxyIfNeeded() { |