| 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 } | 636 } |
| 637 | 637 |
| 638 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( | 638 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( |
| 639 blink::WebGraphicsContext3D* web_graphics_context, | 639 blink::WebGraphicsContext3D* web_graphics_context, |
| 640 unsigned int texture, | 640 unsigned int texture, |
| 641 unsigned int level, | 641 unsigned int level, |
| 642 unsigned int internal_format, | 642 unsigned int internal_format, |
| 643 unsigned int type, | 643 unsigned int type, |
| 644 bool premultiply_alpha, | 644 bool premultiply_alpha, |
| 645 bool flip_y) { | 645 bool flip_y) { |
| 646 return copyVideoTextureToPlatformTexture(web_graphics_context, texture, |
| 647 internal_format, type, |
| 648 premultiply_alpha, flip_y); |
| 649 } |
| 650 |
| 651 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( |
| 652 blink::WebGraphicsContext3D* web_graphics_context, |
| 653 unsigned int texture, |
| 654 unsigned int internal_format, |
| 655 unsigned int type, |
| 656 bool premultiply_alpha, |
| 657 bool flip_y) { |
| 646 DCHECK(main_thread_checker_.CalledOnValidThread()); | 658 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 647 // Don't allow clients to copy an encrypted video frame. | 659 // Don't allow clients to copy an encrypted video frame. |
| 648 if (needs_external_surface_) | 660 if (needs_external_surface_) |
| 649 return false; | 661 return false; |
| 650 | 662 |
| 651 scoped_refptr<VideoFrame> video_frame; | 663 scoped_refptr<VideoFrame> video_frame; |
| 652 { | 664 { |
| 653 base::AutoLock auto_lock(current_frame_lock_); | 665 base::AutoLock auto_lock(current_frame_lock_); |
| 654 video_frame = current_frame_; | 666 video_frame = current_frame_; |
| 655 } | 667 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 672 // The video is stored in an unmultiplied format, so premultiply if | 684 // The video is stored in an unmultiplied format, so premultiply if |
| 673 // necessary. | 685 // necessary. |
| 674 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 686 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
| 675 premultiply_alpha); | 687 premultiply_alpha); |
| 676 | 688 |
| 677 // Application itself needs to take care of setting the right flip_y | 689 // Application itself needs to take care of setting the right flip_y |
| 678 // value down to get the expected result. | 690 // value down to get the expected result. |
| 679 // flip_y==true means to reverse the video orientation while | 691 // flip_y==true means to reverse the video orientation while |
| 680 // flip_y==false means to keep the intrinsic orientation. | 692 // flip_y==false means to keep the intrinsic orientation. |
| 681 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); | 693 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); |
| 682 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, src_texture, | 694 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, src_texture, texture, |
| 683 texture, level, internal_format, | 695 0, internal_format, type); |
| 684 type); | |
| 685 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); | 696 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); |
| 686 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 697 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
| 687 false); | 698 false); |
| 688 | 699 |
| 689 web_graphics_context->deleteTexture(src_texture); | 700 web_graphics_context->deleteTexture(src_texture); |
| 690 web_graphics_context->flush(); | 701 web_graphics_context->flush(); |
| 691 | 702 |
| 692 SyncPointClientImpl client(web_graphics_context); | 703 SyncPointClientImpl client(web_graphics_context); |
| 693 video_frame->UpdateReleaseSyncPoint(&client); | 704 video_frame->UpdateReleaseSyncPoint(&client); |
| 694 return true; | 705 return true; |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 | 1857 |
| 1847 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1858 bool WebMediaPlayerAndroid::IsHLSStream() const { |
| 1848 std::string mime; | 1859 std::string mime; |
| 1849 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1860 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
| 1850 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1861 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
| 1851 return false; | 1862 return false; |
| 1852 return !mime.compare("application/x-mpegurl"); | 1863 return !mime.compare("application/x-mpegurl"); |
| 1853 } | 1864 } |
| 1854 | 1865 |
| 1855 } // namespace content | 1866 } // namespace content |
| OLD | NEW |