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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 864513004: gpu: introduce glCopySubTextureCHROMIUM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove level altogether Created 5 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 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/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 } 621 }
622 622
623 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( 623 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture(
624 blink::WebGraphicsContext3D* web_graphics_context, 624 blink::WebGraphicsContext3D* web_graphics_context,
625 unsigned int texture, 625 unsigned int texture,
626 unsigned int level, 626 unsigned int level,
627 unsigned int internal_format, 627 unsigned int internal_format,
628 unsigned int type, 628 unsigned int type,
629 bool premultiply_alpha, 629 bool premultiply_alpha,
630 bool flip_y) { 630 bool flip_y) {
631 return copyVideoTextureToPlatformTexture(web_graphics_context, texture,
632 internal_format, type,
633 premultiply_alpha, flip_y);
634 }
635
636 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture(
637 blink::WebGraphicsContext3D* web_graphics_context,
638 unsigned int texture,
639 unsigned int internal_format,
640 unsigned int type,
641 bool premultiply_alpha,
642 bool flip_y) {
631 DCHECK(main_thread_checker_.CalledOnValidThread()); 643 DCHECK(main_thread_checker_.CalledOnValidThread());
632 // Don't allow clients to copy an encrypted video frame. 644 // Don't allow clients to copy an encrypted video frame.
633 if (needs_external_surface_) 645 if (needs_external_surface_)
634 return false; 646 return false;
635 647
636 scoped_refptr<VideoFrame> video_frame; 648 scoped_refptr<VideoFrame> video_frame;
637 { 649 {
638 base::AutoLock auto_lock(current_frame_lock_); 650 base::AutoLock auto_lock(current_frame_lock_);
639 video_frame = current_frame_; 651 video_frame = current_frame_;
640 } 652 }
(...skipping 16 matching lines...) Expand all
657 // The video is stored in an unmultiplied format, so premultiply if 669 // The video is stored in an unmultiplied format, so premultiply if
658 // necessary. 670 // necessary.
659 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 671 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
660 premultiply_alpha); 672 premultiply_alpha);
661 673
662 // Application itself needs to take care of setting the right flip_y 674 // Application itself needs to take care of setting the right flip_y
663 // value down to get the expected result. 675 // value down to get the expected result.
664 // flip_y==true means to reverse the video orientation while 676 // flip_y==true means to reverse the video orientation while
665 // flip_y==false means to keep the intrinsic orientation. 677 // flip_y==false means to keep the intrinsic orientation.
666 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); 678 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y);
667 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, src_texture, 679 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, src_texture, texture,
668 texture, level, internal_format, 680 0, internal_format, type);
669 type);
670 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); 681 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
671 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 682 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
672 false); 683 false);
673 684
674 web_graphics_context->deleteTexture(src_texture); 685 web_graphics_context->deleteTexture(src_texture);
675 web_graphics_context->flush(); 686 web_graphics_context->flush();
676 687
677 SyncPointClientImpl client(web_graphics_context); 688 SyncPointClientImpl client(web_graphics_context);
678 video_frame->UpdateReleaseSyncPoint(&client); 689 video_frame->UpdateReleaseSyncPoint(&client);
679 return true; 690 return true;
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 1833
1823 bool WebMediaPlayerAndroid::IsHLSStream() const { 1834 bool WebMediaPlayerAndroid::IsHLSStream() const {
1824 std::string mime; 1835 std::string mime;
1825 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; 1836 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_;
1826 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) 1837 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime))
1827 return false; 1838 return false;
1828 return !mime.compare("application/x-mpegurl"); 1839 return !mime.compare("application/x-mpegurl");
1829 } 1840 }
1830 1841
1831 } // namespace content 1842 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698