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

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: Make VideoFrame keep only one sync point per client 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 const std::map<uintptr_t, uint32>& release_sync_points) {
76 GLES2Interface* gl = factories->ContextGL(); 76 GLES2Interface* gl = factories->ContextGL();
77 for (size_t i = 0; i < release_sync_points.size(); i++) 77 for (std::map<uintptr_t, uint32>::const_iterator iter =
78 gl->WaitSyncPointCHROMIUM(release_sync_points[i]); 78 release_sync_points.begin();
79 iter != release_sync_points.end();
80 iter++) {
81 gl->WaitSyncPointCHROMIUM(iter->second);
82 }
79 gl->DeleteTextures(1, &texture_id); 83 gl->DeleteTextures(1, &texture_id);
80 } 84 }
81 } // namespace 85 } // namespace
82 86
83 namespace content { 87 namespace content {
84 88
85 WebMediaPlayerAndroid::WebMediaPlayerAndroid( 89 WebMediaPlayerAndroid::WebMediaPlayerAndroid(
86 blink::WebFrame* frame, 90 blink::WebFrame* frame,
87 blink::WebMediaPlayerClient* client, 91 blink::WebMediaPlayerClient* client,
88 base::WeakPtr<WebMediaPlayerDelegate> delegate, 92 base::WeakPtr<WebMediaPlayerDelegate> delegate,
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); 533 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
530 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 534 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
531 false); 535 false);
532 536
533 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) 537 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES)
534 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0); 538 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
535 else 539 else
536 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); 540 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture);
537 web_graphics_context->deleteTexture(source_texture); 541 web_graphics_context->deleteTexture(source_texture);
538 web_graphics_context->flush(); 542 web_graphics_context->flush();
539 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint()); 543
544 video_frame->AppendReleaseSyncPoint(
545 reinterpret_cast<uintptr_t>(web_graphics_context),
546 web_graphics_context->insertSyncPoint());
dshwang 2014/06/05 14:38:30 reinterpret_cast here
540 return true; 547 return true;
541 } 548 }
542 549
543 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { 550 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const {
544 if (info_loader_) 551 if (info_loader_)
545 return info_loader_->HasSingleOrigin(); 552 return info_loader_->HasSingleOrigin();
546 // The info loader may have failed. 553 // The info loader may have failed.
547 if (player_type_ == MEDIA_PLAYER_TYPE_URL) 554 if (player_type_ == MEDIA_PLAYER_TYPE_URL)
548 return false; 555 return false;
549 return true; 556 return true;
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 1570
1564 void WebMediaPlayerAndroid::exitFullscreen() { 1571 void WebMediaPlayerAndroid::exitFullscreen() {
1565 player_manager_->ExitFullscreen(player_id_); 1572 player_manager_->ExitFullscreen(player_id_);
1566 } 1573 }
1567 1574
1568 bool WebMediaPlayerAndroid::canEnterFullscreen() const { 1575 bool WebMediaPlayerAndroid::canEnterFullscreen() const {
1569 return player_manager_->CanEnterFullscreen(frame_); 1576 return player_manager_->CanEnterFullscreen(frame_);
1570 } 1577 }
1571 1578
1572 } // namespace content 1579 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698