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

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

Issue 2476693002: WebGL & 16-bit video stream: upload to FLOAT texture. (Closed)
Patch Set: Lossless access to 16-bit video stream using WebGL GL_FLOAT texture. Created 4 years, 1 month 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // GPU Process crashed. 474 // GPU Process crashed.
475 if (!provider) 475 if (!provider)
476 return false; 476 return false;
477 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); 477 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext());
478 DCHECK(context_3d.gl); 478 DCHECK(context_3d.gl);
479 return video_renderer_.CopyVideoFrameTexturesToGLTexture( 479 return video_renderer_.CopyVideoFrameTexturesToGLTexture(
480 context_3d, gl, video_frame.get(), texture, internal_format, type, 480 context_3d, gl, video_frame.get(), texture, internal_format, type,
481 premultiply_alpha, flip_y); 481 premultiply_alpha, flip_y);
482 } 482 }
483 483
484 bool WebMediaPlayerMS::texImageImpl(const char* functionID,
485 unsigned target,
486 gpu::gles2::GLES2Interface* gl,
487 int level,
488 int internalformat,
489 unsigned format,
490 unsigned type,
491 int xoffset,
492 int yoffset,
493 int zoffset,
494 bool flipY,
495 bool premultiplyAlpha) {
496 TRACE_EVENT0("media", "WebMediaPlayerMS:texImageImpl");
497 DCHECK(thread_checker_.CalledOnValidThread());
498
499 const scoped_refptr<media::VideoFrame> video_frame =
500 compositor_->GetCurrentFrameWithoutUpdatingStatistics();
501 if (!video_frame || !video_frame->IsMappable() ||
502 video_frame->HasTextures() ||
503 media::VideoFrame::NumPlanes(video_frame->format()) != 1) {
504 return false;
505 }
506
507 return media::SkCanvasVideoRenderer::TexImageImpl(
508 functionID, target, gl, video_frame.get(), level, internalformat, format,
509 type, xoffset, yoffset, zoffset, flipY, premultiplyAlpha);
510 }
511
484 void WebMediaPlayerMS::OnFrameAvailable( 512 void WebMediaPlayerMS::OnFrameAvailable(
485 const scoped_refptr<media::VideoFrame>& frame) { 513 const scoped_refptr<media::VideoFrame>& frame) {
486 DVLOG(3) << __func__; 514 DVLOG(3) << __func__;
487 DCHECK(thread_checker_.CalledOnValidThread()); 515 DCHECK(thread_checker_.CalledOnValidThread());
488 516
489 if (render_frame_suspended_) 517 if (render_frame_suspended_)
490 return; 518 return;
491 519
492 base::TimeTicks render_time; 520 base::TimeTicks render_time;
493 if (frame->metadata()->GetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, 521 if (frame->metadata()->GetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 void WebMediaPlayerMS::ResetCanvasCache() { 588 void WebMediaPlayerMS::ResetCanvasCache() {
561 DCHECK(thread_checker_.CalledOnValidThread()); 589 DCHECK(thread_checker_.CalledOnValidThread());
562 video_renderer_.ResetCache(); 590 video_renderer_.ResetCache();
563 } 591 }
564 592
565 void WebMediaPlayerMS::TriggerResize() { 593 void WebMediaPlayerMS::TriggerResize() {
566 get_client()->sizeChanged(); 594 get_client()->sizeChanged();
567 } 595 }
568 596
569 } // namespace content 597 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698