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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 } | 1025 } |
1026 | 1026 |
1027 if (stream_texture_proxy_ && video_frame_provider_client_) | 1027 if (stream_texture_proxy_ && video_frame_provider_client_) |
1028 stream_texture_proxy_->SetClient(video_frame_provider_client_); | 1028 stream_texture_proxy_->SetClient(video_frame_provider_client_); |
1029 } | 1029 } |
1030 | 1030 |
1031 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { | 1031 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { |
1032 if (!stream_texture_proxy_) | 1032 if (!stream_texture_proxy_) |
1033 return; | 1033 return; |
1034 | 1034 |
1035 if (media_source_delegate_ && stream_texture_factory_) { | |
1036 // MediaCodec will release the old surface when it goes away, we need to | |
1037 // recreate a new one each time this is called. | |
1038 stream_texture_factory_->DestroyStreamTexture(texture_id_); | |
1039 stream_id_ = 0; | |
1040 texture_id_ = 0; | |
1041 texture_mailbox_ = gpu::Mailbox(); | |
1042 texture_mailbox_sync_point_ = 0; | |
1043 DoCreateStreamTexture(); | |
1044 ReallocateVideoFrame(); | |
1045 stream_texture_proxy_initialized_ = false; | |
1046 } | |
1047 if (stream_texture_factory_.get() && stream_id_) | 1035 if (stream_texture_factory_.get() && stream_id_) |
1048 stream_texture_factory_->EstablishPeer(stream_id_, player_id_); | 1036 stream_texture_factory_->EstablishPeer(stream_id_, player_id_); |
1049 needs_establish_peer_ = false; | 1037 needs_establish_peer_ = false; |
1050 } | 1038 } |
1051 | 1039 |
1052 void WebMediaPlayerAndroid::DoCreateStreamTexture() { | 1040 void WebMediaPlayerAndroid::DoCreateStreamTexture() { |
1053 DCHECK(!stream_id_); | 1041 DCHECK(!stream_id_); |
1054 DCHECK(!texture_id_); | 1042 DCHECK(!texture_id_); |
1055 DCHECK(!texture_mailbox_sync_point_); | 1043 DCHECK(!texture_mailbox_sync_point_); |
1056 stream_id_ = stream_texture_factory_->CreateStreamTexture( | 1044 stream_id_ = stream_texture_factory_->CreateStreamTexture( |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 | 1399 |
1412 void WebMediaPlayerAndroid::exitFullscreen() { | 1400 void WebMediaPlayerAndroid::exitFullscreen() { |
1413 manager_->ExitFullscreen(player_id_); | 1401 manager_->ExitFullscreen(player_id_); |
1414 } | 1402 } |
1415 | 1403 |
1416 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1404 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
1417 return manager_->CanEnterFullscreen(frame_); | 1405 return manager_->CanEnterFullscreen(frame_); |
1418 } | 1406 } |
1419 | 1407 |
1420 } // namespace content | 1408 } // namespace content |
OLD | NEW |