Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 312803002: Android media: VideoFrame should not store so many sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address danakj@'s concern Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 SyncPointProviderImpl : public media::VideoFrame::SyncPointProvider {
82 public:
83 explicit SyncPointProviderImpl(
84 blink::WebGraphicsContext3D* web_graphics_context)
85 : web_graphics_context_(web_graphics_context) {}
86 virtual ~SyncPointProviderImpl();
87 virtual uint32 InsertSyncPoint();
danakj 2014/06/19 15:56:26 since you're in the .cc you could define these met
dshwang 2014/06/23 18:33:20 Done.
88 virtual void WaitSyncPoint(uint32 sync_point);
89
90 private:
91 blink::WebGraphicsContext3D* web_graphics_context_;
92 };
93
94 SyncPointProviderImpl::~SyncPointProviderImpl() {
95 }
96
97 uint32 SyncPointProviderImpl::InsertSyncPoint() {
98 return web_graphics_context_->insertSyncPoint();
99 }
100
101 void SyncPointProviderImpl::WaitSyncPoint(uint32 sync_point) {
102 web_graphics_context_->waitSyncPoint(sync_point);
103 }
104
81 } // namespace 105 } // namespace
82 106
83 namespace content { 107 namespace content {
84 108
85 WebMediaPlayerAndroid::WebMediaPlayerAndroid( 109 WebMediaPlayerAndroid::WebMediaPlayerAndroid(
86 blink::WebFrame* frame, 110 blink::WebFrame* frame,
87 blink::WebMediaPlayerClient* client, 111 blink::WebMediaPlayerClient* client,
88 base::WeakPtr<WebMediaPlayerDelegate> delegate, 112 base::WeakPtr<WebMediaPlayerDelegate> delegate,
89 RendererMediaPlayerManager* player_manager, 113 RendererMediaPlayerManager* player_manager,
90 RendererCdmManager* cdm_manager, 114 RendererCdmManager* cdm_manager,
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); 556 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
533 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 557 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
534 false); 558 false);
535 559
536 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) 560 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES)
537 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0); 561 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
538 else 562 else
539 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); 563 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture);
540 web_graphics_context->deleteTexture(source_texture); 564 web_graphics_context->deleteTexture(source_texture);
541 web_graphics_context->flush(); 565 web_graphics_context->flush();
542 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint()); 566
567 SyncPointProviderImpl provider(web_graphics_context);
568 video_frame->UpdateReleaseSyncPoint(provider);
543 return true; 569 return true;
544 } 570 }
545 571
546 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { 572 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const {
547 if (info_loader_) 573 if (info_loader_)
548 return info_loader_->HasSingleOrigin(); 574 return info_loader_->HasSingleOrigin();
549 // The info loader may have failed. 575 // The info loader may have failed.
550 if (player_type_ == MEDIA_PLAYER_TYPE_URL) 576 if (player_type_ == MEDIA_PLAYER_TYPE_URL)
551 return false; 577 return false;
552 return true; 578 return true;
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 1573
1548 void WebMediaPlayerAndroid::exitFullscreen() { 1574 void WebMediaPlayerAndroid::exitFullscreen() {
1549 player_manager_->ExitFullscreen(player_id_); 1575 player_manager_->ExitFullscreen(player_id_);
1550 } 1576 }
1551 1577
1552 bool WebMediaPlayerAndroid::canEnterFullscreen() const { 1578 bool WebMediaPlayerAndroid::canEnterFullscreen() const {
1553 return player_manager_->CanEnterFullscreen(frame_); 1579 return player_manager_->CanEnterFullscreen(frame_);
1554 } 1580 }
1555 1581
1556 } // namespace content 1582 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698