| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 WebMediaPlayerAndroid::~WebMediaPlayerAndroid() { | 158 WebMediaPlayerAndroid::~WebMediaPlayerAndroid() { |
| 159 SetVideoFrameProviderClient(NULL); | 159 SetVideoFrameProviderClient(NULL); |
| 160 client_->setWebLayer(NULL); | 160 client_->setWebLayer(NULL); |
| 161 | 161 |
| 162 if (proxy_) | 162 if (proxy_) |
| 163 proxy_->DestroyPlayer(player_id_); | 163 proxy_->DestroyPlayer(player_id_); |
| 164 | 164 |
| 165 if (stream_id_) | 165 if (stream_id_) |
| 166 stream_texture_factory_->DestroyStreamTexture(texture_id_); | 166 stream_texture_factory_->DestroyStreamTexture(stream_id_); |
| 167 | 167 |
| 168 if (manager_) | 168 if (manager_) |
| 169 manager_->UnregisterMediaPlayer(player_id_); | 169 manager_->UnregisterMediaPlayer(player_id_); |
| 170 | 170 |
| 171 if (base::MessageLoop::current()) | 171 if (base::MessageLoop::current()) |
| 172 base::MessageLoop::current()->RemoveDestructionObserver(this); | 172 base::MessageLoop::current()->RemoveDestructionObserver(this); |
| 173 | 173 |
| 174 if (source_type_ == MediaPlayerAndroid::SOURCE_TYPE_MSE && delegate_) | 174 if (source_type_ == MediaPlayerAndroid::SOURCE_TYPE_MSE && delegate_) |
| 175 delegate_->PlayerGone(this); | 175 delegate_->PlayerGone(this); |
| 176 | 176 |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 } | 777 } |
| 778 | 778 |
| 779 void WebMediaPlayerAndroid::WillDestroyCurrentMessageLoop() { | 779 void WebMediaPlayerAndroid::WillDestroyCurrentMessageLoop() { |
| 780 if (manager_) | 780 if (manager_) |
| 781 manager_->UnregisterMediaPlayer(player_id_); | 781 manager_->UnregisterMediaPlayer(player_id_); |
| 782 Detach(); | 782 Detach(); |
| 783 } | 783 } |
| 784 | 784 |
| 785 void WebMediaPlayerAndroid::Detach() { | 785 void WebMediaPlayerAndroid::Detach() { |
| 786 if (stream_id_) { | 786 if (stream_id_) { |
| 787 stream_texture_factory_->DestroyStreamTexture(texture_id_); | 787 stream_texture_factory_->DestroyStreamTexture(stream_id_); |
| 788 stream_id_ = 0; | 788 stream_id_ = 0; |
| 789 } | 789 } |
| 790 | 790 |
| 791 media_source_delegate_.reset(); | 791 media_source_delegate_.reset(); |
| 792 current_frame_ = NULL; | 792 current_frame_ = NULL; |
| 793 manager_ = NULL; | 793 manager_ = NULL; |
| 794 proxy_ = NULL; | 794 proxy_ = NULL; |
| 795 } | 795 } |
| 796 | 796 |
| 797 void WebMediaPlayerAndroid::ReallocateVideoFrame() { | 797 void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 } | 845 } |
| 846 | 846 |
| 847 void WebMediaPlayerAndroid::PutCurrentFrame( | 847 void WebMediaPlayerAndroid::PutCurrentFrame( |
| 848 const scoped_refptr<media::VideoFrame>& frame) { | 848 const scoped_refptr<media::VideoFrame>& frame) { |
| 849 } | 849 } |
| 850 | 850 |
| 851 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { | 851 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { |
| 852 if (media_source_delegate_ && stream_texture_factory_) { | 852 if (media_source_delegate_ && stream_texture_factory_) { |
| 853 // MediaCodec will release the old surface when it goes away, we need to | 853 // MediaCodec will release the old surface when it goes away, we need to |
| 854 // recreate a new one each time this is called. | 854 // recreate a new one each time this is called. |
| 855 stream_texture_factory_->DestroyStreamTexture(texture_id_); | 855 stream_texture_factory_->DestroyStreamTexture(stream_id_); |
| 856 stream_id_ = 0; | 856 stream_id_ = 0; |
| 857 texture_id_ = 0; | 857 texture_id_ = 0; |
| 858 texture_mailbox_ = gpu::Mailbox(); | 858 texture_mailbox_ = gpu::Mailbox(); |
| 859 texture_mailbox_sync_point_ = 0; | 859 texture_mailbox_sync_point_ = 0; |
| 860 stream_id_ = stream_texture_factory_->CreateStreamTexture( | 860 stream_id_ = stream_texture_factory_->CreateStreamTexture( |
| 861 kGLTextureExternalOES, | 861 kGLTextureExternalOES, |
| 862 &texture_id_, | 862 &texture_id_, |
| 863 &texture_mailbox_, | 863 &texture_mailbox_, |
| 864 &texture_mailbox_sync_point_); | 864 &texture_mailbox_sync_point_); |
| 865 ReallocateVideoFrame(); | 865 ReallocateVideoFrame(); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 | 1164 |
| 1165 void WebMediaPlayerAndroid::exitFullscreen() { | 1165 void WebMediaPlayerAndroid::exitFullscreen() { |
| 1166 proxy_->ExitFullscreen(player_id_); | 1166 proxy_->ExitFullscreen(player_id_); |
| 1167 } | 1167 } |
| 1168 | 1168 |
| 1169 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1169 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
| 1170 return manager_->CanEnterFullscreen(frame_); | 1170 return manager_->CanEnterFullscreen(frame_); |
| 1171 } | 1171 } |
| 1172 | 1172 |
| 1173 } // namespace content | 1173 } // namespace content |
| OLD | NEW |