Chromium Code Reviews| Index: webkit/media/android/webmediaplayer_android.cc |
| diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc |
| index ef8248ee9af952df578271e955df160667a4420b..cc9f165edf0b0e4724c5b983bf2b1d9dccc75970 100644 |
| --- a/webkit/media/android/webmediaplayer_android.cc |
| +++ b/webkit/media/android/webmediaplayer_android.cc |
| @@ -42,6 +42,7 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid( |
| is_playing_(false), |
| needs_establish_peer_(true), |
| has_size_info_(false), |
| + is_in_video_view_(false), |
| stream_texture_factory_(factory) { |
| main_loop_->AddDestructionObserver(this); |
| if (manager_) |
| @@ -376,13 +377,17 @@ void WebMediaPlayerAndroid::WillDestroyCurrentMessageLoop() { |
| } |
| void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
| - if (texture_id_) { |
| - video_frame_.reset(new WebVideoFrameImpl(VideoFrame::WrapNativeTexture( |
| - texture_id_, kGLTextureExternalOES, natural_size_, |
| - gfx::Rect(natural_size_), natural_size_, base::TimeDelta(), |
| - VideoFrame::ReadPixelsCB(), |
| - base::Closure()))); |
| + unsigned int texture_id = texture_id_; |
|
qinmin
2012/12/17 19:34:06
you also want to change the ctor of this class, to
wonsik2
2013/02/14 14:56:38
I think it might make sense to support them both a
|
| + if (is_in_video_view_) { |
| + texture_id = 0; |
| + } else if (texture_id_ == 0) { |
| + return; |
| } |
| + video_frame_.reset(new WebVideoFrameImpl(VideoFrame::WrapNativeTexture( |
| + texture_id, kGLTextureExternalOES, natural_size_, |
| + gfx::Rect(natural_size_), natural_size_, base::TimeDelta(), |
| + VideoFrame::ReadPixelsCB(), |
| + base::Closure()))); |
| } |
| WebVideoFrame* WebMediaPlayerAndroid::getCurrentFrame() { |
| @@ -415,6 +420,11 @@ void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { |
| needs_establish_peer_ = needs_establish_peer; |
| } |
| +void WebMediaPlayerAndroid::SetIsInVideoView(bool is_in_video_view) { |
| + is_in_video_view_ = is_in_video_view;; |
| + ReallocateVideoFrame(); |
| +} |
| + |
| void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { |
| is_playing_ = is_playing; |
| } |