OLD | NEW |
---|---|
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> |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
715 | 715 |
716 void WebMediaPlayerImpl::PutCurrentFrame( | 716 void WebMediaPlayerImpl::PutCurrentFrame( |
717 const scoped_refptr<media::VideoFrame>& frame) { | 717 const scoped_refptr<media::VideoFrame>& frame) { |
718 if (!accelerated_compositing_reported_) { | 718 if (!accelerated_compositing_reported_) { |
719 accelerated_compositing_reported_ = true; | 719 accelerated_compositing_reported_ = true; |
720 DCHECK(frame_->view()->isAcceleratedCompositingActive()); | 720 DCHECK(frame_->view()->isAcceleratedCompositingActive()); |
721 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", true); | 721 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", true); |
722 } | 722 } |
723 } | 723 } |
724 | 724 |
725 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( | 725 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
piman
2013/04/11 22:57:58
Is this the same as the webgl thing for printing?
danakj
2013/04/11 23:49:08
I think this should work fine now without ubercomp
piman
2013/04/12 00:54:25
As it is today, Produce/Consume is (locally) destr
| |
726 WebKit::WebGraphicsContext3D* web_graphics_context, | 726 WebKit::WebGraphicsContext3D* web_graphics_context, |
727 unsigned int texture, | 727 unsigned int texture, |
728 unsigned int level, | 728 unsigned int level, |
729 unsigned int internal_format, | 729 unsigned int internal_format, |
730 bool premultiply_alpha, | 730 bool premultiply_alpha, |
731 bool flip_y) { | 731 bool flip_y) { |
732 scoped_refptr<media::VideoFrame> video_frame; | 732 scoped_refptr<media::VideoFrame> video_frame; |
733 { | 733 { |
734 base::AutoLock auto_lock(lock_); | 734 base::AutoLock auto_lock(lock_); |
735 video_frame = current_frame_; | 735 video_frame = current_frame_; |
736 } | 736 } |
737 if (video_frame && | 737 if (video_frame && |
738 video_frame->format() == media::VideoFrame::NATIVE_TEXTURE && | 738 video_frame->format() == media::VideoFrame::NATIVE_TEXTURE && |
739 video_frame->texture_target() == GL_TEXTURE_2D) { | 739 video_frame->texture_target() == GL_TEXTURE_2D) { |
740 uint32 source_texture = video_frame->texture_id(); | 740 uint32 source_texture = web_graphics_context->createTexture(); |
741 | |
742 web_graphics_context->bindTexture(GL_TEXTURE_2D, source_texture); | |
743 const gpu::Mailbox& mailbox = video_frame->texture_mailbox(); | |
744 web_graphics_context->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | |
745 | |
741 // The video is stored in a unmultiplied format, so premultiply | 746 // The video is stored in a unmultiplied format, so premultiply |
742 // if necessary. | 747 // if necessary. |
743 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 748 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
744 premultiply_alpha); | 749 premultiply_alpha); |
745 // Application itself needs to take care of setting the right flip_y | 750 // Application itself needs to take care of setting the right flip_y |
746 // value down to get the expected result. | 751 // value down to get the expected result. |
747 // flip_y==true means to reverse the video orientation while | 752 // flip_y==true means to reverse the video orientation while |
748 // flip_y==false means to keep the intrinsic orientation. | 753 // flip_y==false means to keep the intrinsic orientation. |
749 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); | 754 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); |
750 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, | 755 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, |
751 source_texture, texture, level, internal_format); | 756 source_texture, texture, level, internal_format); |
752 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); | 757 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); |
753 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 758 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
754 false); | 759 false); |
760 | |
761 web_graphics_context->deleteTexture(source_texture); | |
762 | |
755 // The flush() operation is not necessary here. It is kept since the | 763 // The flush() operation is not necessary here. It is kept since the |
756 // performance will be better when it is added than not. | 764 // performance will be better when it is added than not. |
757 web_graphics_context->flush(); | 765 web_graphics_context->flush(); |
758 return true; | 766 return true; |
759 } | 767 } |
760 return false; | 768 return false; |
761 } | 769 } |
762 | 770 |
763 // Helper functions to report media EME related stats to UMA. They follow the | 771 // Helper functions to report media EME related stats to UMA. They follow the |
764 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and | 772 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1266 | 1274 |
1267 if (pending_repaint_) | 1275 if (pending_repaint_) |
1268 return; | 1276 return; |
1269 | 1277 |
1270 pending_repaint_ = true; | 1278 pending_repaint_ = true; |
1271 main_loop_->PostTask(FROM_HERE, base::Bind( | 1279 main_loop_->PostTask(FROM_HERE, base::Bind( |
1272 &WebMediaPlayerImpl::Repaint, AsWeakPtr())); | 1280 &WebMediaPlayerImpl::Repaint, AsWeakPtr())); |
1273 } | 1281 } |
1274 | 1282 |
1275 } // namespace webkit_media | 1283 } // namespace webkit_media |
OLD | NEW |