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

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

Issue 12412007: Add a new API in WebMediaPlayer to do a GPU-GPU textures copy if possible (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add new API in WebMediaPlayer to do GPU-GPU textures copy Created 7 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/media/webmediaplayer_impl.h" 5 #include "webkit/media/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/message_loop_proxy.h" 14 #include "base/message_loop_proxy.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #include "media/audio/null_audio_sink.h" 18 #include "media/audio/null_audio_sink.h"
19 #include "media/base/bind_to_loop.h" 19 #include "media/base/bind_to_loop.h"
20 #include "media/base/filter_collection.h" 20 #include "media/base/filter_collection.h"
21 #include "media/base/limits.h" 21 #include "media/base/limits.h"
22 #include "media/base/media_log.h" 22 #include "media/base/media_log.h"
23 #include "media/base/pipeline.h" 23 #include "media/base/pipeline.h"
24 #include "media/base/video_frame.h" 24 #include "media/base/video_frame.h"
25 #include "media/filters/audio_renderer_impl.h" 25 #include "media/filters/audio_renderer_impl.h"
26 #include "media/filters/chunk_demuxer.h" 26 #include "media/filters/chunk_demuxer.h"
27 #include "media/filters/video_renderer_base.h" 27 #include "media/filters/video_renderer_base.h"
28 #include "third_party/khronos/GLES2/gl2.h"
28 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" 29 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
29 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 30 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
30 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 31 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
31 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" 32 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaSource.h" 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaSource.h"
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
35 #include "v8/include/v8.h" 36 #include "v8/include/v8.h"
36 #include "webkit/media/buffered_data_source.h" 37 #include "webkit/media/buffered_data_source.h"
37 #include "webkit/media/filter_helpers.h" 38 #include "webkit/media/filter_helpers.h"
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 void WebMediaPlayerImpl::putCurrentFrame( 664 void WebMediaPlayerImpl::putCurrentFrame(
664 WebKit::WebVideoFrame* web_video_frame) { 665 WebKit::WebVideoFrame* web_video_frame) {
665 if (!accelerated_compositing_reported_) { 666 if (!accelerated_compositing_reported_) {
666 accelerated_compositing_reported_ = true; 667 accelerated_compositing_reported_ = true;
667 DCHECK(frame_->view()->isAcceleratedCompositingActive()); 668 DCHECK(frame_->view()->isAcceleratedCompositingActive());
668 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", true); 669 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", true);
669 } 670 }
670 delete web_video_frame; 671 delete web_video_frame;
671 } 672 }
672 673
674 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(
675 WebKit::WebGraphicsContext3D* webGraphicsContext,
scherkus (not reviewing) 2013/03/08 20:17:37 web_graphics_context
676 unsigned int texture,
677 unsigned int level,
678 unsigned int internalFormat) {
scherkus (not reviewing) 2013/03/08 20:17:37 internal_format
679 scoped_refptr<media::VideoFrame> video_frame;
680 {
681 base::AutoLock auto_lock(lock_);
682 video_frame = current_frame_;
683 }
684 if (video_frame
scherkus (not reviewing) 2013/03/08 20:17:37 chromium puts && at the end of lines
685 && video_frame->format() == media::VideoFrame::NATIVE_TEXTURE
686 && video_frame->texture_target() == GL_TEXTURE_2D) {
687 uint32 sourceTexture = video_frame->texture_id();
scherkus (not reviewing) 2013/03/08 20:17:37 source_texture
688 webGraphicsContext->copyTextureCHROMIUM(GL_TEXTURE_2D,
689 sourceTexture, texture, level, internalFormat);
690 return true;
691 }
692 return false;
693 }
694
673 // Helper enum for reporting generateKeyRequest/addKey histograms. 695 // Helper enum for reporting generateKeyRequest/addKey histograms.
674 enum MediaKeyException { 696 enum MediaKeyException {
675 kUnknownResultId, 697 kUnknownResultId,
676 kSuccess, 698 kSuccess,
677 kKeySystemNotSupported, 699 kKeySystemNotSupported,
678 kInvalidPlayerState, 700 kInvalidPlayerState,
679 kMaxMediaKeyException 701 kMaxMediaKeyException
680 }; 702 };
681 703
682 static MediaKeyException MediaKeyExceptionForUMA( 704 static MediaKeyException MediaKeyExceptionForUMA(
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1180
1159 if (pending_repaint_) 1181 if (pending_repaint_)
1160 return; 1182 return;
1161 1183
1162 pending_repaint_ = true; 1184 pending_repaint_ = true;
1163 main_loop_->PostTask(FROM_HERE, base::Bind( 1185 main_loop_->PostTask(FROM_HERE, base::Bind(
1164 &WebMediaPlayerImpl::Repaint, AsWeakPtr())); 1186 &WebMediaPlayerImpl::Repaint, AsWeakPtr()));
1165 } 1187 }
1166 1188
1167 } // namespace webkit_media 1189 } // namespace webkit_media
OLDNEW
« webkit/media/webmediaplayer_impl.h ('K') | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698