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

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

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WebGL video to texture support and readPixels from R16UI for CPU access Created 4 years, 4 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/webmediaplayer_ms.h" 5 #include "content/renderer/media/webmediaplayer_ms.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { 462 media::VideoFrame::NumPlanes(video_frame->format()) != 1) {
463 return false; 463 return false;
464 } 464 }
465 465
466 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( 466 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture(
467 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, 467 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha,
468 flip_y); 468 flip_y);
469 return true; 469 return true;
470 } 470 }
471 471
472 bool WebMediaPlayerMS::texImageImpl(const char* functionID,
473 unsigned target,
474 gpu::gles2::GLES2Interface* gl,
475 int level,
476 int internalformat,
477 unsigned format,
478 unsigned type,
479 int xoffset,
480 int yoffset,
481 int zoffset,
482 bool flipY,
483 bool premultiplyAlpha) {
484 TRACE_EVENT0("media", "WebMediaPlayerMS:texImageImpl");
485 DCHECK(thread_checker_.CalledOnValidThread());
486
487 const scoped_refptr<media::VideoFrame> video_frame =
488 compositor_->GetCurrentFrameWithoutUpdatingStatistics();
489 if (!video_frame || !video_frame->IsMappable() ||
490 media::VideoFrame::NumPlanes(video_frame->format()) != 1) {
491 return false;
492 }
493
494 return media::SkCanvasVideoRenderer::TexImageImpl(
495 functionID, target, gl, video_frame.get(), level, internalformat, format,
496 type, xoffset, yoffset, zoffset, flipY, premultiplyAlpha);
497 }
498
472 void WebMediaPlayerMS::OnFrameAvailable( 499 void WebMediaPlayerMS::OnFrameAvailable(
473 const scoped_refptr<media::VideoFrame>& frame) { 500 const scoped_refptr<media::VideoFrame>& frame) {
474 DVLOG(3) << __FUNCTION__; 501 DVLOG(3) << __FUNCTION__;
475 DCHECK(thread_checker_.CalledOnValidThread()); 502 DCHECK(thread_checker_.CalledOnValidThread());
476 503
477 if (render_frame_suspended_) 504 if (render_frame_suspended_)
478 return; 505 return;
479 506
480 base::TimeTicks render_time; 507 base::TimeTicks render_time;
481 if (frame->metadata()->GetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, 508 if (frame->metadata()->GetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 void WebMediaPlayerMS::ResetCanvasCache() { 563 void WebMediaPlayerMS::ResetCanvasCache() {
537 DCHECK(thread_checker_.CalledOnValidThread()); 564 DCHECK(thread_checker_.CalledOnValidThread());
538 video_renderer_.ResetCache(); 565 video_renderer_.ResetCache();
539 } 566 }
540 567
541 void WebMediaPlayerMS::TriggerResize() { 568 void WebMediaPlayerMS::TriggerResize() {
542 get_client()->sizeChanged(); 569 get_client()->sizeChanged();
543 } 570 }
544 571
545 } // namespace content 572 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698