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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 1420843005: Revert of "webgl: optimize webgl.texSubImage2D(video) path." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/renderers/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 "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 645
646 unsigned WebMediaPlayerImpl::videoDecodedByteCount() const { 646 unsigned WebMediaPlayerImpl::videoDecodedByteCount() const {
647 DCHECK(main_task_runner_->BelongsToCurrentThread()); 647 DCHECK(main_task_runner_->BelongsToCurrentThread());
648 648
649 PipelineStatistics stats = pipeline_.GetStatistics(); 649 PipelineStatistics stats = pipeline_.GetStatistics();
650 return stats.video_bytes_decoded; 650 return stats.video_bytes_decoded;
651 } 651 }
652 652
653 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( 653 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(
654 blink::WebGraphicsContext3D* web_graphics_context, 654 blink::WebGraphicsContext3D* web_graphics_context,
655 const CopyVideoTextureParams& params) { 655 unsigned int texture,
656 unsigned int internal_format,
657 unsigned int type,
658 bool premultiply_alpha,
659 bool flip_y) {
656 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); 660 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture");
657 DCHECK((params.copyType == CopyVideoTextureParams::FullCopy &&
658 !params.xoffset && !params.yoffset) ||
659 (params.copyType == CopyVideoTextureParams::SubCopy &&
660 !params.internalFormat && !params.type));
661 661
662 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); 662 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
663 663
664 if (!video_frame.get() || !video_frame->HasTextures() || 664 if (!video_frame.get() || !video_frame->HasTextures() ||
665 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { 665 media::VideoFrame::NumPlanes(video_frame->format()) != 1) {
666 return false; 666 return false;
667 } 667 }
668 668
669 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to 669 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to
670 // GLES2Interface. 670 // GLES2Interface.
671 gpu::gles2::GLES2Interface* gl = 671 gpu::gles2::GLES2Interface* gl =
672 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) 672 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context)
673 ->GetGLInterface(); 673 ->GetGLInterface();
674 typedef SkCanvasVideoRenderer::CopyFrameSingleTextureParams CopyParams;
675 SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( 674 SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture(
676 gl, video_frame.get(), 675 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha,
677 CopyParams(params.copyType == CopyVideoTextureParams::FullCopy 676 flip_y);
678 ? CopyParams::FullCopy
679 : CopyParams::SubCopy,
680 params.target, params.texture, params.internalFormat,
681 params.type, params.level, params.xoffset, params.yoffset,
682 params.premultiplyAlpha, params.flipY));
683 return true; 677 return true;
684 } 678 }
685 679
686 WebMediaPlayer::MediaKeyException 680 WebMediaPlayer::MediaKeyException
687 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system, 681 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system,
688 const unsigned char* init_data, 682 const unsigned char* init_data,
689 unsigned init_data_length) { 683 unsigned init_data_length) {
690 DCHECK(main_task_runner_->BelongsToCurrentThread()); 684 DCHECK(main_task_runner_->BelongsToCurrentThread());
691 685
692 return encrypted_media_support_.GenerateKeyRequest( 686 return encrypted_media_support_.GenerateKeyRequest(
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1106 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1113 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1107 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1114 << ", Demuxer: " << (demuxer_ ? demuxer_->GetMemoryUsage() : 0); 1108 << ", Demuxer: " << (demuxer_ ? demuxer_->GetMemoryUsage() : 0);
1115 1109
1116 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1110 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1117 last_reported_memory_usage_ = current_memory_usage; 1111 last_reported_memory_usage_ = current_memory_usage;
1118 adjust_allocated_memory_cb_.Run(delta); 1112 adjust_allocated_memory_cb_.Run(delta);
1119 } 1113 }
1120 1114
1121 } // namespace media 1115 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/renderers/skcanvas_video_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698