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

Side by Side Diff: content/renderer/media/webmediaplayer_ms.cc

Issue 1315323006: webgl: optimize webgl.texSubImage2D(video) path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't use c++11 initialize-list Created 5 years, 2 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
« no previous file with comments | « content/renderer/media/webmediaplayer_ms.h ('k') | media/blink/skcanvas_video_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/webmediaplayer_ms.h" 5 #include "content/renderer/media/webmediaplayer_ms.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 342
343 unsigned WebMediaPlayerMS::videoDecodedByteCount() const { 343 unsigned WebMediaPlayerMS::videoDecodedByteCount() const {
344 DCHECK(thread_checker_.CalledOnValidThread()); 344 DCHECK(thread_checker_.CalledOnValidThread());
345 NOTIMPLEMENTED(); 345 NOTIMPLEMENTED();
346 return 0; 346 return 0;
347 } 347 }
348 348
349 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( 349 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture(
350 blink::WebGraphicsContext3D* web_graphics_context, 350 blink::WebGraphicsContext3D* web_graphics_context,
351 unsigned int texture, 351 const CopyVideoTextureParams& params) {
352 unsigned int internal_format,
353 unsigned int type,
354 bool premultiply_alpha,
355 bool flip_y) {
356 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); 352 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture");
357 DCHECK(thread_checker_.CalledOnValidThread()); 353 DCHECK(thread_checker_.CalledOnValidThread());
354 DCHECK((params.copyType == CopyVideoTextureParams::FullCopy &&
355 !params.xoffset && !params.yoffset) ||
356 (params.copyType == CopyVideoTextureParams::SubCopy &&
357 !params.internalFormat && !params.type));
358 358
359 scoped_refptr<media::VideoFrame> video_frame = compositor_->GetCurrentFrame(); 359 scoped_refptr<media::VideoFrame> video_frame = compositor_->GetCurrentFrame();
360 360
361 if (!video_frame.get() || video_frame->HasTextures() || 361 if (!video_frame.get() || video_frame->HasTextures() ||
362 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { 362 media::VideoFrame::NumPlanes(video_frame->format()) != 1) {
363 return false; 363 return false;
364 } 364 }
365 365
366 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to 366 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to
367 // GLES2Interface. 367 // GLES2Interface.
368 gpu::gles2::GLES2Interface* const gl = 368 gpu::gles2::GLES2Interface* const gl =
369 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) 369 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context)
370 ->GetGLInterface(); 370 ->GetGLInterface();
371 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( 371 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture(
372 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, 372 gl, video_frame.get(),
373 flip_y); 373 media::SkCanvasVideoRenderer::CopyFrameSingleTextureParams(
piman 2015/10/22 21:30:23 nit: you may help readability with a function-loca
dshwang 2015/10/23 11:09:27 Good idea! Done.
374 params.copyType == CopyVideoTextureParams::FullCopy
375 ? media::SkCanvasVideoRenderer::CopyFrameSingleTextureParams::
376 FullCopy
377 : media::SkCanvasVideoRenderer::CopyFrameSingleTextureParams::
378 SubCopy,
379 params.target, params.texture, params.internalFormat, params.type,
380 params.level, params.xoffset, params.yoffset, params.premultiplyAlpha,
381 params.flipY));
374 return true; 382 return true;
375 } 383 }
376 384
377 void WebMediaPlayerMS::OnFrameAvailable( 385 void WebMediaPlayerMS::OnFrameAvailable(
378 const scoped_refptr<media::VideoFrame>& frame) { 386 const scoped_refptr<media::VideoFrame>& frame) {
379 DVLOG(3) << __FUNCTION__; 387 DVLOG(3) << __FUNCTION__;
380 DCHECK(thread_checker_.CalledOnValidThread()); 388 DCHECK(thread_checker_.CalledOnValidThread());
381 389
382 base::TimeTicks render_time; 390 base::TimeTicks render_time;
383 if (frame->metadata()->GetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, 391 if (frame->metadata()->GetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 get_client()->networkStateChanged(); 441 get_client()->networkStateChanged();
434 } 442 }
435 443
436 void WebMediaPlayerMS::SetReadyState(WebMediaPlayer::ReadyState state) { 444 void WebMediaPlayerMS::SetReadyState(WebMediaPlayer::ReadyState state) {
437 DCHECK(thread_checker_.CalledOnValidThread()); 445 DCHECK(thread_checker_.CalledOnValidThread());
438 ready_state_ = state; 446 ready_state_ = state;
439 // Always notify to ensure client has the latest value. 447 // Always notify to ensure client has the latest value.
440 get_client()->readyStateChanged(); 448 get_client()->readyStateChanged();
441 } 449 }
442 } // namespace content 450 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webmediaplayer_ms.h ('k') | media/blink/skcanvas_video_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698