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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 using media::VideoFrame; | 65 using media::VideoFrame; |
66 | 66 |
67 namespace { | 67 namespace { |
68 // Prefix for histograms related to Encrypted Media Extensions. | 68 // Prefix for histograms related to Encrypted Media Extensions. |
69 const char* kMediaEme = "Media.EME."; | 69 const char* kMediaEme = "Media.EME."; |
70 | 70 |
71 // File-static function is to allow it to run even after WMPA is deleted. | 71 // File-static function is to allow it to run even after WMPA is deleted. |
72 void OnReleaseTexture( | 72 void OnReleaseTexture( |
73 const scoped_refptr<content::StreamTextureFactory>& factories, | 73 const scoped_refptr<content::StreamTextureFactory>& factories, |
74 uint32 texture_id, | 74 uint32 texture_id, |
75 const std::vector<uint32>& release_sync_points) { | 75 uint32 release_sync_point) { |
76 GLES2Interface* gl = factories->ContextGL(); | 76 GLES2Interface* gl = factories->ContextGL(); |
77 for (size_t i = 0; i < release_sync_points.size(); i++) | 77 gl->WaitSyncPointCHROMIUM(release_sync_point); |
78 gl->WaitSyncPointCHROMIUM(release_sync_points[i]); | |
79 gl->DeleteTextures(1, &texture_id); | 78 gl->DeleteTextures(1, &texture_id); |
80 } | 79 } |
| 80 |
| 81 class SyncPointClientImpl : public media::VideoFrame::SyncPointClient { |
| 82 public: |
| 83 explicit SyncPointClientImpl( |
| 84 blink::WebGraphicsContext3D* web_graphics_context) |
| 85 : web_graphics_context_(web_graphics_context) {} |
| 86 virtual ~SyncPointClientImpl() {} |
| 87 virtual uint32 InsertSyncPoint() OVERRIDE { |
| 88 return web_graphics_context_->insertSyncPoint(); |
| 89 } |
| 90 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE { |
| 91 web_graphics_context_->waitSyncPoint(sync_point); |
| 92 } |
| 93 |
| 94 private: |
| 95 blink::WebGraphicsContext3D* web_graphics_context_; |
| 96 }; |
| 97 |
81 } // namespace | 98 } // namespace |
82 | 99 |
83 namespace content { | 100 namespace content { |
84 | 101 |
85 WebMediaPlayerAndroid::WebMediaPlayerAndroid( | 102 WebMediaPlayerAndroid::WebMediaPlayerAndroid( |
86 blink::WebFrame* frame, | 103 blink::WebFrame* frame, |
87 blink::WebMediaPlayerClient* client, | 104 blink::WebMediaPlayerClient* client, |
88 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 105 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
89 RendererMediaPlayerManager* player_manager, | 106 RendererMediaPlayerManager* player_manager, |
90 RendererCdmManager* cdm_manager, | 107 RendererCdmManager* cdm_manager, |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); | 549 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); |
533 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 550 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
534 false); | 551 false); |
535 | 552 |
536 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) | 553 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) |
537 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0); | 554 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0); |
538 else | 555 else |
539 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); | 556 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); |
540 web_graphics_context->deleteTexture(source_texture); | 557 web_graphics_context->deleteTexture(source_texture); |
541 web_graphics_context->flush(); | 558 web_graphics_context->flush(); |
542 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint()); | 559 |
| 560 SyncPointClientImpl client(web_graphics_context); |
| 561 video_frame->UpdateReleaseSyncPoint(&client); |
543 return true; | 562 return true; |
544 } | 563 } |
545 | 564 |
546 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { | 565 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { |
547 if (info_loader_) | 566 if (info_loader_) |
548 return info_loader_->HasSingleOrigin(); | 567 return info_loader_->HasSingleOrigin(); |
549 // The info loader may have failed. | 568 // The info loader may have failed. |
550 if (player_type_ == MEDIA_PLAYER_TYPE_URL) | 569 if (player_type_ == MEDIA_PLAYER_TYPE_URL) |
551 return false; | 570 return false; |
552 return true; | 571 return true; |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 | 1560 |
1542 void WebMediaPlayerAndroid::exitFullscreen() { | 1561 void WebMediaPlayerAndroid::exitFullscreen() { |
1543 player_manager_->ExitFullscreen(player_id_); | 1562 player_manager_->ExitFullscreen(player_id_); |
1544 } | 1563 } |
1545 | 1564 |
1546 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1565 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
1547 return player_manager_->CanEnterFullscreen(frame_); | 1566 return player_manager_->CanEnterFullscreen(frame_); |
1548 } | 1567 } |
1549 | 1568 |
1550 } // namespace content | 1569 } // namespace content |
OLD | NEW |