OLD | NEW |
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 Loading... |
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) { | |
643 DCHECK(main_thread_checker_.CalledOnValidThread()); | 631 DCHECK(main_thread_checker_.CalledOnValidThread()); |
644 // Don't allow clients to copy an encrypted video frame. | 632 // Don't allow clients to copy an encrypted video frame. |
645 if (needs_external_surface_) | 633 if (needs_external_surface_) |
646 return false; | 634 return false; |
647 | 635 |
648 scoped_refptr<VideoFrame> video_frame; | 636 scoped_refptr<VideoFrame> video_frame; |
649 { | 637 { |
650 base::AutoLock auto_lock(current_frame_lock_); | 638 base::AutoLock auto_lock(current_frame_lock_); |
651 video_frame = current_frame_; | 639 video_frame = current_frame_; |
652 } | 640 } |
(...skipping 16 matching lines...) Expand all Loading... |
669 // The video is stored in an unmultiplied format, so premultiply if | 657 // The video is stored in an unmultiplied format, so premultiply if |
670 // necessary. | 658 // necessary. |
671 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 659 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
672 premultiply_alpha); | 660 premultiply_alpha); |
673 | 661 |
674 // Application itself needs to take care of setting the right flip_y | 662 // Application itself needs to take care of setting the right flip_y |
675 // value down to get the expected result. | 663 // value down to get the expected result. |
676 // flip_y==true means to reverse the video orientation while | 664 // flip_y==true means to reverse the video orientation while |
677 // flip_y==false means to keep the intrinsic orientation. | 665 // flip_y==false means to keep the intrinsic orientation. |
678 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); | 666 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); |
679 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, src_texture, texture, | 667 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, src_texture, |
680 0, internal_format, type); | 668 texture, level, internal_format, |
| 669 type); |
681 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); | 670 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); |
682 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 671 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
683 false); | 672 false); |
684 | 673 |
685 web_graphics_context->deleteTexture(src_texture); | 674 web_graphics_context->deleteTexture(src_texture); |
686 web_graphics_context->flush(); | 675 web_graphics_context->flush(); |
687 | 676 |
688 SyncPointClientImpl client(web_graphics_context); | 677 SyncPointClientImpl client(web_graphics_context); |
689 video_frame->UpdateReleaseSyncPoint(&client); | 678 video_frame->UpdateReleaseSyncPoint(&client); |
690 return true; | 679 return true; |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 | 1822 |
1834 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1823 bool WebMediaPlayerAndroid::IsHLSStream() const { |
1835 std::string mime; | 1824 std::string mime; |
1836 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1825 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
1837 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1826 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
1838 return false; | 1827 return false; |
1839 return !mime.compare("application/x-mpegurl"); | 1828 return !mime.compare("application/x-mpegurl"); |
1840 } | 1829 } |
1841 | 1830 |
1842 } // namespace content | 1831 } // namespace content |
OLD | NEW |