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