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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return true; | 130 return true; |
131 } | 131 } |
132 | 132 |
133 class SyncTokenClientImpl : public media::VideoFrame::SyncTokenClient { | 133 class SyncTokenClientImpl : public media::VideoFrame::SyncTokenClient { |
134 public: | 134 public: |
135 explicit SyncTokenClientImpl( | 135 explicit SyncTokenClientImpl( |
136 blink::WebGraphicsContext3D* web_graphics_context) | 136 blink::WebGraphicsContext3D* web_graphics_context) |
137 : web_graphics_context_(web_graphics_context) {} | 137 : web_graphics_context_(web_graphics_context) {} |
138 ~SyncTokenClientImpl() override {} | 138 ~SyncTokenClientImpl() override {} |
139 void GenerateSyncToken(gpu::SyncToken* sync_token) override { | 139 void GenerateSyncToken(gpu::SyncToken* sync_token) override { |
140 const blink::WGC3Duint64 fence_sync = | 140 if (!web_graphics_context_->insertSyncPoint(sync_token->GetData())) { |
141 web_graphics_context_->insertFenceSyncCHROMIUM(); | |
142 if (!web_graphics_context_->genSyncTokenCHROMIUM(fence_sync, | |
143 sync_token->GetData())) { | |
144 sync_token->Clear(); | 141 sync_token->Clear(); |
145 } | 142 } |
146 } | 143 } |
147 void WaitSyncToken(const gpu::SyncToken& sync_token) override { | 144 void WaitSyncToken(const gpu::SyncToken& sync_token) override { |
148 web_graphics_context_->waitSyncTokenCHROMIUM(sync_token.GetConstData()); | 145 web_graphics_context_->waitSyncToken(sync_token.GetConstData()); |
149 } | 146 } |
150 | 147 |
151 private: | 148 private: |
152 blink::WebGraphicsContext3D* web_graphics_context_; | 149 blink::WebGraphicsContext3D* web_graphics_context_; |
153 }; | 150 }; |
154 | 151 |
155 } // namespace | 152 } // namespace |
156 | 153 |
157 namespace content { | 154 namespace content { |
158 | 155 |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 } | 680 } |
684 | 681 |
685 if (!video_frame.get() || !video_frame->HasTextures()) | 682 if (!video_frame.get() || !video_frame->HasTextures()) |
686 return false; | 683 return false; |
687 DCHECK_EQ(1u, media::VideoFrame::NumPlanes(video_frame->format())); | 684 DCHECK_EQ(1u, media::VideoFrame::NumPlanes(video_frame->format())); |
688 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0); | 685 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0); |
689 DCHECK((!is_remote_ && | 686 DCHECK((!is_remote_ && |
690 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES) || | 687 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES) || |
691 (is_remote_ && mailbox_holder.texture_target == GL_TEXTURE_2D)); | 688 (is_remote_ && mailbox_holder.texture_target == GL_TEXTURE_2D)); |
692 | 689 |
693 web_graphics_context->waitSyncTokenCHROMIUM( | 690 web_graphics_context->waitSyncToken(mailbox_holder.sync_token.GetConstData()); |
694 mailbox_holder.sync_token.GetConstData()); | |
695 | 691 |
696 // Ensure the target of texture is set before copyTextureCHROMIUM, otherwise | 692 // Ensure the target of texture is set before copyTextureCHROMIUM, otherwise |
697 // an invalid texture target may be used for copy texture. | 693 // an invalid texture target may be used for copy texture. |
698 uint32 src_texture = | 694 uint32 src_texture = |
699 web_graphics_context->createAndConsumeTextureCHROMIUM( | 695 web_graphics_context->createAndConsumeTextureCHROMIUM( |
700 mailbox_holder.texture_target, mailbox_holder.mailbox.name); | 696 mailbox_holder.texture_target, mailbox_holder.mailbox.name); |
701 | 697 |
702 // Application itself needs to take care of setting the right flip_y | 698 // Application itself needs to take care of setting the right flip_y |
703 // value down to get the expected result. | 699 // value down to get the expected result. |
704 // flip_y==true means to reverse the video orientation while | 700 // flip_y==true means to reverse the video orientation while |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 | 1921 |
1926 bool is_hls = IsHLSStream(); | 1922 bool is_hls = IsHLSStream(); |
1927 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); | 1923 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); |
1928 if (is_hls) { | 1924 if (is_hls) { |
1929 media::RecordOriginOfHLSPlayback( | 1925 media::RecordOriginOfHLSPlayback( |
1930 GURL(frame_->document().securityOrigin().toString())); | 1926 GURL(frame_->document().securityOrigin().toString())); |
1931 } | 1927 } |
1932 } | 1928 } |
1933 | 1929 |
1934 } // namespace content | 1930 } // namespace content |
OLD | NEW |