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 "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 size_t WebMediaPlayerImpl::videoDecodedByteCount() const { | 896 size_t WebMediaPlayerImpl::videoDecodedByteCount() const { |
897 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 897 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
898 | 898 |
899 PipelineStatistics stats = pipeline_.GetStatistics(); | 899 PipelineStatistics stats = pipeline_.GetStatistics(); |
900 return stats.video_bytes_decoded; | 900 return stats.video_bytes_decoded; |
901 } | 901 } |
902 | 902 |
903 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( | 903 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
904 gpu::gles2::GLES2Interface* gl, | 904 gpu::gles2::GLES2Interface* gl, |
905 unsigned int texture, | 905 unsigned int texture, |
906 unsigned int internal_format, | |
907 unsigned int type, | |
908 bool premultiply_alpha, | 906 bool premultiply_alpha, |
909 bool flip_y) { | 907 bool flip_y) { |
910 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 908 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
911 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 909 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
912 | 910 |
913 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when | 911 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when |
914 // we have other ways to check if decoder owns video frame. | 912 // we have other ways to check if decoder owns video frame. |
915 // See http://crbug.com/595716 and http://crbug.com/602708 | 913 // See http://crbug.com/595716 and http://crbug.com/602708 |
916 if (cdm_) | 914 if (cdm_) |
917 return false; | 915 return false; |
918 | 916 |
919 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 917 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
920 if (!video_frame.get() || !video_frame->HasTextures()) { | 918 if (!video_frame.get() || !video_frame->HasTextures()) { |
921 return false; | 919 return false; |
922 } | 920 } |
923 | 921 |
924 Context3D context_3d; | 922 Context3D context_3d; |
925 if (!context_3d_cb_.is_null()) | 923 if (!context_3d_cb_.is_null()) |
926 context_3d = context_3d_cb_.Run(); | 924 context_3d = context_3d_cb_.Run(); |
927 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( | 925 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( |
928 context_3d, gl, video_frame.get(), texture, internal_format, type, | 926 context_3d, gl, video_frame.get(), texture, premultiply_alpha, flip_y); |
929 premultiply_alpha, flip_y); | |
930 } | 927 } |
931 | 928 |
932 void WebMediaPlayerImpl::setContentDecryptionModule( | 929 void WebMediaPlayerImpl::setContentDecryptionModule( |
933 blink::WebContentDecryptionModule* cdm, | 930 blink::WebContentDecryptionModule* cdm, |
934 blink::WebContentDecryptionModuleResult result) { | 931 blink::WebContentDecryptionModuleResult result) { |
935 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 932 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
936 | 933 |
937 // Once the CDM is set it can't be cleared as there may be frames being | 934 // Once the CDM is set it can't be cleared as there may be frames being |
938 // decrypted on other threads. So fail this request. | 935 // decrypted on other threads. So fail this request. |
939 // http://crbug.com/462365#c7. | 936 // http://crbug.com/462365#c7. |
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2085 bool WebMediaPlayerImpl::ShouldPauseWhenHidden() const { | 2082 bool WebMediaPlayerImpl::ShouldPauseWhenHidden() const { |
2086 #if defined(OS_ANDROID) // WMPI_CAST | 2083 #if defined(OS_ANDROID) // WMPI_CAST |
2087 if (isRemote()) | 2084 if (isRemote()) |
2088 return false; | 2085 return false; |
2089 #endif // defined(OS_ANDROID) // WMPI_CAST | 2086 #endif // defined(OS_ANDROID) // WMPI_CAST |
2090 | 2087 |
2091 return hasVideo() && !hasAudio(); | 2088 return hasVideo() && !hasAudio(); |
2092 } | 2089 } |
2093 | 2090 |
2094 } // namespace media | 2091 } // namespace media |
OLD | NEW |