| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 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 DCHECK(texture_id_); |
| 167 stream_texture_factory_->DestroyStreamTexture(stream_id_, texture_id_); |
| 168 } |
| 167 | 169 |
| 168 if (manager_) | 170 if (manager_) |
| 169 manager_->UnregisterMediaPlayer(player_id_); | 171 manager_->UnregisterMediaPlayer(player_id_); |
| 170 | 172 |
| 171 if (base::MessageLoop::current()) | 173 if (base::MessageLoop::current()) |
| 172 base::MessageLoop::current()->RemoveDestructionObserver(this); | 174 base::MessageLoop::current()->RemoveDestructionObserver(this); |
| 173 | 175 |
| 174 if (source_type_ == MediaPlayerAndroid::SOURCE_TYPE_MSE && delegate_) | 176 if (source_type_ == MediaPlayerAndroid::SOURCE_TYPE_MSE && delegate_) |
| 175 delegate_->PlayerGone(this); | 177 delegate_->PlayerGone(this); |
| 176 | 178 |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 } | 779 } |
| 778 | 780 |
| 779 void WebMediaPlayerAndroid::WillDestroyCurrentMessageLoop() { | 781 void WebMediaPlayerAndroid::WillDestroyCurrentMessageLoop() { |
| 780 if (manager_) | 782 if (manager_) |
| 781 manager_->UnregisterMediaPlayer(player_id_); | 783 manager_->UnregisterMediaPlayer(player_id_); |
| 782 Detach(); | 784 Detach(); |
| 783 } | 785 } |
| 784 | 786 |
| 785 void WebMediaPlayerAndroid::Detach() { | 787 void WebMediaPlayerAndroid::Detach() { |
| 786 if (stream_id_) { | 788 if (stream_id_) { |
| 787 stream_texture_factory_->DestroyStreamTexture(texture_id_); | 789 DCHECK(texture_id_); |
| 790 stream_texture_factory_->DestroyStreamTexture(stream_id_, texture_id_); |
| 788 stream_id_ = 0; | 791 stream_id_ = 0; |
| 789 } | 792 } |
| 790 | 793 |
| 791 media_source_delegate_.reset(); | 794 media_source_delegate_.reset(); |
| 792 current_frame_ = NULL; | 795 current_frame_ = NULL; |
| 793 manager_ = NULL; | 796 manager_ = NULL; |
| 794 proxy_ = NULL; | 797 proxy_ = NULL; |
| 795 } | 798 } |
| 796 | 799 |
| 797 void WebMediaPlayerAndroid::ReallocateVideoFrame() { | 800 void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 } | 848 } |
| 846 | 849 |
| 847 void WebMediaPlayerAndroid::PutCurrentFrame( | 850 void WebMediaPlayerAndroid::PutCurrentFrame( |
| 848 const scoped_refptr<media::VideoFrame>& frame) { | 851 const scoped_refptr<media::VideoFrame>& frame) { |
| 849 } | 852 } |
| 850 | 853 |
| 851 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { | 854 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { |
| 852 if (media_source_delegate_ && stream_texture_factory_) { | 855 if (media_source_delegate_ && stream_texture_factory_) { |
| 853 // MediaCodec will release the old surface when it goes away, we need to | 856 // MediaCodec will release the old surface when it goes away, we need to |
| 854 // recreate a new one each time this is called. | 857 // recreate a new one each time this is called. |
| 855 stream_texture_factory_->DestroyStreamTexture(texture_id_); | 858 DCHECK(stream_id_ && texture_id_); |
| 859 stream_texture_factory_->DestroyStreamTexture(stream_id_, texture_id_); |
| 856 stream_id_ = 0; | 860 stream_id_ = 0; |
| 857 texture_id_ = 0; | 861 texture_id_ = 0; |
| 858 texture_mailbox_ = gpu::Mailbox(); | 862 texture_mailbox_ = gpu::Mailbox(); |
| 859 texture_mailbox_sync_point_ = 0; | 863 texture_mailbox_sync_point_ = 0; |
| 860 stream_id_ = stream_texture_factory_->CreateStreamTexture( | 864 stream_id_ = stream_texture_factory_->CreateStreamTexture( |
| 861 kGLTextureExternalOES, | 865 kGLTextureExternalOES, |
| 862 &texture_id_, | 866 &texture_id_, |
| 863 &texture_mailbox_, | 867 &texture_mailbox_, |
| 864 &texture_mailbox_sync_point_); | 868 &texture_mailbox_sync_point_); |
| 865 ReallocateVideoFrame(); | 869 ReallocateVideoFrame(); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 | 1168 |
| 1165 void WebMediaPlayerAndroid::exitFullscreen() { | 1169 void WebMediaPlayerAndroid::exitFullscreen() { |
| 1166 proxy_->ExitFullscreen(player_id_); | 1170 proxy_->ExitFullscreen(player_id_); |
| 1167 } | 1171 } |
| 1168 | 1172 |
| 1169 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1173 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
| 1170 return manager_->CanEnterFullscreen(frame_); | 1174 return manager_->CanEnterFullscreen(frame_); |
| 1171 } | 1175 } |
| 1172 | 1176 |
| 1173 } // namespace content | 1177 } // namespace content |
| OLD | NEW |