Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 850993002: gpu video: optimize HW video to SW canvas and implement it for WebRTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android build fail Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
1183 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM(); 1183 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM();
1184 1184
1185 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( 1185 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture(
1186 make_scoped_ptr(new gpu::MailboxHolder(texture_mailbox, texture_target, 1186 make_scoped_ptr(new gpu::MailboxHolder(texture_mailbox, texture_target,
1187 texture_mailbox_sync_point)), 1187 texture_mailbox_sync_point)),
1188 media::BindToCurrentLoop(base::Bind(&OnReleaseTexture, 1188 media::BindToCurrentLoop(base::Bind(&OnReleaseTexture,
1189 stream_texture_factory_, 1189 stream_texture_factory_,
1190 remote_playback_texture_id)), 1190 remote_playback_texture_id)),
1191 canvas_size /* coded_size */, gfx::Rect(canvas_size) /* visible_rect */, 1191 canvas_size /* coded_size */, gfx::Rect(canvas_size) /* visible_rect */,
1192 canvas_size /* natural_size */, base::TimeDelta() /* timestamp */, 1192 canvas_size /* natural_size */, base::TimeDelta() /* timestamp */,
1193 VideoFrame::ReadPixelsCB(), false /* allow overlay */); 1193 false /* allow overlay */);
1194 SetCurrentFrameInternal(new_frame); 1194 SetCurrentFrameInternal(new_frame);
1195 } 1195 }
1196 1196
1197 void WebMediaPlayerAndroid::ReallocateVideoFrame() { 1197 void WebMediaPlayerAndroid::ReallocateVideoFrame() {
1198 DCHECK(main_thread_checker_.CalledOnValidThread()); 1198 DCHECK(main_thread_checker_.CalledOnValidThread());
1199 if (needs_external_surface_) { 1199 if (needs_external_surface_) {
1200 // VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE. 1200 // VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE.
1201 #if defined(VIDEO_HOLE) 1201 #if defined(VIDEO_HOLE)
1202 if (!natural_size_.isEmpty()) { 1202 if (!natural_size_.isEmpty()) {
1203 // 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 15 matching lines...) Expand all
1219 texture_target, texture_mailbox_.name); 1219 texture_target, texture_mailbox_.name);
1220 gl->Flush(); 1220 gl->Flush();
1221 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM(); 1221 GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM();
1222 1222
1223 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture( 1223 scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture(
1224 make_scoped_ptr(new gpu::MailboxHolder(texture_mailbox_, texture_target, 1224 make_scoped_ptr(new gpu::MailboxHolder(texture_mailbox_, texture_target,
1225 texture_mailbox_sync_point)), 1225 texture_mailbox_sync_point)),
1226 media::BindToCurrentLoop(base::Bind( 1226 media::BindToCurrentLoop(base::Bind(
1227 &OnReleaseTexture, stream_texture_factory_, texture_id_ref)), 1227 &OnReleaseTexture, stream_texture_factory_, texture_id_ref)),
1228 natural_size_, gfx::Rect(natural_size_), natural_size_, 1228 natural_size_, gfx::Rect(natural_size_), natural_size_,
1229 base::TimeDelta(), VideoFrame::ReadPixelsCB(), false); 1229 base::TimeDelta(), false);
1230 SetCurrentFrameInternal(new_frame); 1230 SetCurrentFrameInternal(new_frame);
1231 } 1231 }
1232 } 1232 }
1233 1233
1234 void WebMediaPlayerAndroid::SetVideoFrameProviderClient( 1234 void WebMediaPlayerAndroid::SetVideoFrameProviderClient(
1235 cc::VideoFrameProvider::Client* client) { 1235 cc::VideoFrameProvider::Client* client) {
1236 // This is called from both the main renderer thread and the compositor 1236 // This is called from both the main renderer thread and the compositor
1237 // thread (when the main thread is blocked). 1237 // thread (when the main thread is blocked).
1238 1238
1239 // Set the callback target when a frame is produced. Need to do this before 1239 // Set the callback target when a frame is produced. Need to do this before
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 1822
1823 bool WebMediaPlayerAndroid::IsHLSStream() const { 1823 bool WebMediaPlayerAndroid::IsHLSStream() const {
1824 std::string mime; 1824 std::string mime;
1825 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; 1825 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_;
1826 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) 1826 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime))
1827 return false; 1827 return false;
1828 return !mime.compare("application/x-mpegurl"); 1828 return !mime.compare("application/x-mpegurl");
1829 } 1829 }
1830 1830
1831 } // namespace content 1831 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698