| 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/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 | 1183 |
| 1184 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( | 1184 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( |
| 1185 make_scoped_ptr(new gpu::MailboxHolder( | 1185 make_scoped_ptr(new gpu::MailboxHolder( |
| 1186 texture_mailbox, texture_target, texture_mailbox_sync_point)), | 1186 texture_mailbox, texture_target, texture_mailbox_sync_point)), |
| 1187 media::BindToCurrentLoop(base::Bind(&OnReleaseTexture, | 1187 media::BindToCurrentLoop(base::Bind(&OnReleaseTexture, |
| 1188 stream_texture_factory_, | 1188 stream_texture_factory_, |
| 1189 remote_playback_texture_id)), | 1189 remote_playback_texture_id)), |
| 1190 canvas_size /* coded_size */, | 1190 canvas_size /* coded_size */, |
| 1191 gfx::Rect(canvas_size) /* visible_rect */, | 1191 gfx::Rect(canvas_size) /* visible_rect */, |
| 1192 canvas_size /* natural_size */, | 1192 canvas_size /* natural_size */, |
| 1193 base::TimeDelta() /* timestamp */, | 1193 base::TimeDelta()); /* timestamp */ |
| 1194 VideoFrame::ReadPixelsCB()); | |
| 1195 SetCurrentFrameInternal(new_frame); | 1194 SetCurrentFrameInternal(new_frame); |
| 1196 } | 1195 } |
| 1197 | 1196 |
| 1198 void WebMediaPlayerAndroid::ReallocateVideoFrame() { | 1197 void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
| 1199 DCHECK(main_thread_checker_.CalledOnValidThread()); | 1198 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 1200 if (needs_external_surface_) { | 1199 if (needs_external_surface_) { |
| 1201 // VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE. | 1200 // VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE. |
| 1202 #if defined(VIDEO_HOLE) | 1201 #if defined(VIDEO_HOLE) |
| 1203 if (!natural_size_.isEmpty()) { | 1202 if (!natural_size_.isEmpty()) { |
| 1204 // Now we finally know that "stream texture" and "video frame" won't | 1203 // Now we finally know that "stream texture" and "video frame" won't |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1222 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM(); | 1221 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM(); |
| 1223 | 1222 |
| 1224 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( | 1223 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( |
| 1225 make_scoped_ptr(new gpu::MailboxHolder( | 1224 make_scoped_ptr(new gpu::MailboxHolder( |
| 1226 texture_mailbox_, texture_target, texture_mailbox_sync_point)), | 1225 texture_mailbox_, texture_target, texture_mailbox_sync_point)), |
| 1227 media::BindToCurrentLoop(base::Bind( | 1226 media::BindToCurrentLoop(base::Bind( |
| 1228 &OnReleaseTexture, stream_texture_factory_, texture_id_ref)), | 1227 &OnReleaseTexture, stream_texture_factory_, texture_id_ref)), |
| 1229 natural_size_, | 1228 natural_size_, |
| 1230 gfx::Rect(natural_size_), | 1229 gfx::Rect(natural_size_), |
| 1231 natural_size_, | 1230 natural_size_, |
| 1232 base::TimeDelta(), | 1231 base::TimeDelta()); |
| 1233 VideoFrame::ReadPixelsCB()); | |
| 1234 SetCurrentFrameInternal(new_frame); | 1232 SetCurrentFrameInternal(new_frame); |
| 1235 } | 1233 } |
| 1236 } | 1234 } |
| 1237 | 1235 |
| 1238 void WebMediaPlayerAndroid::SetVideoFrameProviderClient( | 1236 void WebMediaPlayerAndroid::SetVideoFrameProviderClient( |
| 1239 cc::VideoFrameProvider::Client* client) { | 1237 cc::VideoFrameProvider::Client* client) { |
| 1240 // This is called from both the main renderer thread and the compositor | 1238 // This is called from both the main renderer thread and the compositor |
| 1241 // thread (when the main thread is blocked). | 1239 // thread (when the main thread is blocked). |
| 1242 | 1240 |
| 1243 // Set the callback target when a frame is produced. Need to do this before | 1241 // Set the callback target when a frame is produced. Need to do this before |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 | 1797 |
| 1800 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1798 bool WebMediaPlayerAndroid::IsHLSStream() const { |
| 1801 std::string mime; | 1799 std::string mime; |
| 1802 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1800 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
| 1803 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1801 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
| 1804 return false; | 1802 return false; |
| 1805 return !mime.compare("application/x-mpegurl"); | 1803 return !mime.compare("application/x-mpegurl"); |
| 1806 } | 1804 } |
| 1807 | 1805 |
| 1808 } // namespace content | 1806 } // namespace content |
| OLD | NEW |