| 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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM(); | 1204 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM(); |
| 1205 | 1205 |
| 1206 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( | 1206 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( |
| 1207 gpu::MailboxHolder(texture_mailbox, texture_target, | 1207 gpu::MailboxHolder(texture_mailbox, texture_target, |
| 1208 texture_mailbox_sync_point), | 1208 texture_mailbox_sync_point), |
| 1209 media::BindToCurrentLoop(base::Bind(&OnReleaseTexture, | 1209 media::BindToCurrentLoop(base::Bind(&OnReleaseTexture, |
| 1210 stream_texture_factory_, | 1210 stream_texture_factory_, |
| 1211 remote_playback_texture_id)), | 1211 remote_playback_texture_id)), |
| 1212 canvas_size /* coded_size */, gfx::Rect(canvas_size) /* visible_rect */, | 1212 canvas_size /* coded_size */, gfx::Rect(canvas_size) /* visible_rect */, |
| 1213 canvas_size /* natural_size */, base::TimeDelta() /* timestamp */, | 1213 canvas_size /* natural_size */, base::TimeDelta() /* timestamp */, |
| 1214 false /* allow overlay */); | 1214 false /* allow overlay */, true /* has_alpha */); |
| 1215 SetCurrentFrameInternal(new_frame); | 1215 SetCurrentFrameInternal(new_frame); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 void WebMediaPlayerAndroid::ReallocateVideoFrame() { | 1218 void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
| 1219 DCHECK(main_thread_checker_.CalledOnValidThread()); | 1219 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 1220 if (needs_external_surface_) { | 1220 if (needs_external_surface_) { |
| 1221 // VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE. | 1221 // VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE. |
| 1222 #if defined(VIDEO_HOLE) | 1222 #if defined(VIDEO_HOLE) |
| 1223 if (!natural_size_.isEmpty()) { | 1223 if (!natural_size_.isEmpty()) { |
| 1224 // Now we finally know that "stream texture" and "video frame" won't | 1224 // Now we finally know that "stream texture" and "video frame" won't |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1240 texture_target, texture_mailbox_.name); | 1240 texture_target, texture_mailbox_.name); |
| 1241 gl->Flush(); | 1241 gl->Flush(); |
| 1242 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM(); | 1242 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM(); |
| 1243 | 1243 |
| 1244 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( | 1244 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( |
| 1245 gpu::MailboxHolder(texture_mailbox_, texture_target, | 1245 gpu::MailboxHolder(texture_mailbox_, texture_target, |
| 1246 texture_mailbox_sync_point), | 1246 texture_mailbox_sync_point), |
| 1247 media::BindToCurrentLoop(base::Bind( | 1247 media::BindToCurrentLoop(base::Bind( |
| 1248 &OnReleaseTexture, stream_texture_factory_, texture_id_ref)), | 1248 &OnReleaseTexture, stream_texture_factory_, texture_id_ref)), |
| 1249 natural_size_, gfx::Rect(natural_size_), natural_size_, | 1249 natural_size_, gfx::Rect(natural_size_), natural_size_, |
| 1250 base::TimeDelta(), false); | 1250 base::TimeDelta(), false /* allow_overlay */, true /* has_alpha */); |
| 1251 SetCurrentFrameInternal(new_frame); | 1251 SetCurrentFrameInternal(new_frame); |
| 1252 } | 1252 } |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 void WebMediaPlayerAndroid::SetVideoFrameProviderClient( | 1255 void WebMediaPlayerAndroid::SetVideoFrameProviderClient( |
| 1256 cc::VideoFrameProvider::Client* client) { | 1256 cc::VideoFrameProvider::Client* client) { |
| 1257 // This is called from both the main renderer thread and the compositor | 1257 // This is called from both the main renderer thread and the compositor |
| 1258 // thread (when the main thread is blocked). | 1258 // thread (when the main thread is blocked). |
| 1259 | 1259 |
| 1260 // Set the callback target when a frame is produced. Need to do this before | 1260 // Set the callback target when a frame is produced. Need to do this before |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1857 | 1857 |
| 1858 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1858 bool WebMediaPlayerAndroid::IsHLSStream() const { |
| 1859 std::string mime; | 1859 std::string mime; |
| 1860 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1860 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
| 1861 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1861 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
| 1862 return false; | 1862 return false; |
| 1863 return !mime.compare("application/x-mpegurl"); | 1863 return !mime.compare("application/x-mpegurl"); |
| 1864 } | 1864 } |
| 1865 | 1865 |
| 1866 } // namespace content | 1866 } // namespace content |
| OLD | NEW |