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

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

Issue 175223003: HW Video: Make media::VideoFrame handle the sync point of the compositor as well as webgl (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: make mailbox in VideoFrame const Created 6 years, 8 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 using media::VideoFrame; 63 using media::VideoFrame;
64 64
65 namespace { 65 namespace {
66 // Prefix for histograms related to Encrypted Media Extensions. 66 // Prefix for histograms related to Encrypted Media Extensions.
67 const char* kMediaEme = "Media.EME."; 67 const char* kMediaEme = "Media.EME.";
68 68
69 // File-static function is to allow it to run even after WMPA is deleted. 69 // File-static function is to allow it to run even after WMPA is deleted.
70 void OnReleaseTexture( 70 void OnReleaseTexture(
71 const scoped_refptr<content::StreamTextureFactory>& factories, 71 const scoped_refptr<content::StreamTextureFactory>& factories,
72 uint32 texture_id, 72 uint32 texture_id,
73 scoped_ptr<gpu::MailboxHolder> mailbox_holder) { 73 const std::vector<uint32>& release_sync_points) {
74 GLES2Interface* gl = factories->ContextGL(); 74 GLES2Interface* gl = factories->ContextGL();
75 if (mailbox_holder->sync_point) 75 for (size_t i = 0; i < release_sync_points.size(); i++)
76 gl->WaitSyncPointCHROMIUM(mailbox_holder->sync_point); 76 gl->WaitSyncPointCHROMIUM(release_sync_points[i]);
77 gl->DeleteTextures(1, &texture_id); 77 gl->DeleteTextures(1, &texture_id);
78 } 78 }
79 } // namespace 79 } // namespace
80 80
81 namespace content { 81 namespace content {
82 82
83 WebMediaPlayerAndroid::WebMediaPlayerAndroid( 83 WebMediaPlayerAndroid::WebMediaPlayerAndroid(
84 blink::WebFrame* frame, 84 blink::WebFrame* frame,
85 blink::WebMediaPlayerClient* client, 85 blink::WebMediaPlayerClient* client,
86 base::WeakPtr<WebMediaPlayerDelegate> delegate, 86 base::WeakPtr<WebMediaPlayerDelegate> delegate,
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 scoped_refptr<VideoFrame> video_frame; 452 scoped_refptr<VideoFrame> video_frame;
453 { 453 {
454 base::AutoLock auto_lock(current_frame_lock_); 454 base::AutoLock auto_lock(current_frame_lock_);
455 video_frame = current_frame_; 455 video_frame = current_frame_;
456 } 456 }
457 457
458 if (!video_frame || 458 if (!video_frame ||
459 video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) 459 video_frame->format() != media::VideoFrame::NATIVE_TEXTURE)
460 return false; 460 return false;
461 gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); 461 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder();
462 DCHECK((!is_remote_ && 462 DCHECK((!is_remote_ &&
463 mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) || 463 mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) ||
464 (is_remote_ && mailbox_holder->texture_target == GL_TEXTURE_2D)); 464 (is_remote_ && mailbox_holder->texture_target == GL_TEXTURE_2D));
465 465
466 // For hidden video element (with style "display:none"), ensure the texture 466 // For hidden video element (with style "display:none"), ensure the texture
467 // size is set. 467 // size is set.
468 if (!is_remote_ && 468 if (!is_remote_ &&
469 (cached_stream_texture_size_.width != natural_size_.width || 469 (cached_stream_texture_size_.width != natural_size_.width ||
470 cached_stream_texture_size_.height != natural_size_.height)) { 470 cached_stream_texture_size_.height != natural_size_.height)) {
471 stream_texture_factory_->SetStreamTextureSize( 471 stream_texture_factory_->SetStreamTextureSize(
(...skipping 27 matching lines...) Expand all
499 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); 499 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
500 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 500 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
501 false); 501 false);
502 502
503 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) 503 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES)
504 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0); 504 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
505 else 505 else
506 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); 506 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture);
507 web_graphics_context->deleteTexture(source_texture); 507 web_graphics_context->deleteTexture(source_texture);
508 web_graphics_context->flush(); 508 web_graphics_context->flush();
509 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint());
509 return true; 510 return true;
510 } 511 }
511 512
512 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { 513 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const {
513 if (info_loader_) 514 if (info_loader_)
514 return info_loader_->HasSingleOrigin(); 515 return info_loader_->HasSingleOrigin();
515 // The info loader may have failed. 516 // The info loader may have failed.
516 if (player_type_ == MEDIA_PLAYER_TYPE_URL) 517 if (player_type_ == MEDIA_PLAYER_TYPE_URL)
517 return false; 518 return false;
518 return true; 519 return true;
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 1532
1532 void WebMediaPlayerAndroid::exitFullscreen() { 1533 void WebMediaPlayerAndroid::exitFullscreen() {
1533 manager_->ExitFullscreen(player_id_); 1534 manager_->ExitFullscreen(player_id_);
1534 } 1535 }
1535 1536
1536 bool WebMediaPlayerAndroid::canEnterFullscreen() const { 1537 bool WebMediaPlayerAndroid::canEnterFullscreen() const {
1537 return manager_->CanEnterFullscreen(frame_); 1538 return manager_->CanEnterFullscreen(frame_);
1538 } 1539 }
1539 1540
1540 } // namespace content 1541 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698