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

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: rebase to ToT Created 6 years, 7 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 using media::VideoFrame; 64 using media::VideoFrame;
65 65
66 namespace { 66 namespace {
67 // Prefix for histograms related to Encrypted Media Extensions. 67 // Prefix for histograms related to Encrypted Media Extensions.
68 const char* kMediaEme = "Media.EME."; 68 const char* kMediaEme = "Media.EME.";
69 69
70 // File-static function is to allow it to run even after WMPA is deleted. 70 // File-static function is to allow it to run even after WMPA is deleted.
71 void OnReleaseTexture( 71 void OnReleaseTexture(
72 const scoped_refptr<content::StreamTextureFactory>& factories, 72 const scoped_refptr<content::StreamTextureFactory>& factories,
73 uint32 texture_id, 73 uint32 texture_id,
74 scoped_ptr<gpu::MailboxHolder> mailbox_holder) { 74 const std::vector<uint32>& release_sync_points) {
75 GLES2Interface* gl = factories->ContextGL(); 75 GLES2Interface* gl = factories->ContextGL();
76 if (mailbox_holder->sync_point) 76 for (size_t i = 0; i < release_sync_points.size(); i++)
77 gl->WaitSyncPointCHROMIUM(mailbox_holder->sync_point); 77 gl->WaitSyncPointCHROMIUM(release_sync_points[i]);
78 gl->DeleteTextures(1, &texture_id); 78 gl->DeleteTextures(1, &texture_id);
79 } 79 }
80 } // namespace 80 } // namespace
81 81
82 namespace content { 82 namespace content {
83 83
84 WebMediaPlayerAndroid::WebMediaPlayerAndroid( 84 WebMediaPlayerAndroid::WebMediaPlayerAndroid(
85 blink::WebFrame* frame, 85 blink::WebFrame* frame,
86 blink::WebMediaPlayerClient* client, 86 blink::WebMediaPlayerClient* client,
87 base::WeakPtr<WebMediaPlayerDelegate> delegate, 87 base::WeakPtr<WebMediaPlayerDelegate> delegate,
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 scoped_refptr<VideoFrame> video_frame; 462 scoped_refptr<VideoFrame> video_frame;
463 { 463 {
464 base::AutoLock auto_lock(current_frame_lock_); 464 base::AutoLock auto_lock(current_frame_lock_);
465 video_frame = current_frame_; 465 video_frame = current_frame_;
466 } 466 }
467 467
468 if (!video_frame || 468 if (!video_frame ||
469 video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) 469 video_frame->format() != media::VideoFrame::NATIVE_TEXTURE)
470 return false; 470 return false;
471 gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); 471 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder();
472 DCHECK((!is_remote_ && 472 DCHECK((!is_remote_ &&
473 mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) || 473 mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) ||
474 (is_remote_ && mailbox_holder->texture_target == GL_TEXTURE_2D)); 474 (is_remote_ && mailbox_holder->texture_target == GL_TEXTURE_2D));
475 475
476 // For hidden video element (with style "display:none"), ensure the texture 476 // For hidden video element (with style "display:none"), ensure the texture
477 // size is set. 477 // size is set.
478 if (!is_remote_ && 478 if (!is_remote_ &&
479 (cached_stream_texture_size_.width != natural_size_.width || 479 (cached_stream_texture_size_.width != natural_size_.width ||
480 cached_stream_texture_size_.height != natural_size_.height)) { 480 cached_stream_texture_size_.height != natural_size_.height)) {
481 stream_texture_factory_->SetStreamTextureSize( 481 stream_texture_factory_->SetStreamTextureSize(
(...skipping 27 matching lines...) Expand all
509 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); 509 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
510 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 510 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
511 false); 511 false);
512 512
513 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES) 513 if (mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES)
514 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0); 514 web_graphics_context->bindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
515 else 515 else
516 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); 516 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture);
517 web_graphics_context->deleteTexture(source_texture); 517 web_graphics_context->deleteTexture(source_texture);
518 web_graphics_context->flush(); 518 web_graphics_context->flush();
519 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint());
519 return true; 520 return true;
520 } 521 }
521 522
522 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { 523 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const {
523 if (info_loader_) 524 if (info_loader_)
524 return info_loader_->HasSingleOrigin(); 525 return info_loader_->HasSingleOrigin();
525 // The info loader may have failed. 526 // The info loader may have failed.
526 if (player_type_ == MEDIA_PLAYER_TYPE_URL) 527 if (player_type_ == MEDIA_PLAYER_TYPE_URL)
527 return false; 528 return false;
528 return true; 529 return true;
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 1544
1544 void WebMediaPlayerAndroid::exitFullscreen() { 1545 void WebMediaPlayerAndroid::exitFullscreen() {
1545 manager_->ExitFullscreen(player_id_); 1546 manager_->ExitFullscreen(player_id_);
1546 } 1547 }
1547 1548
1548 bool WebMediaPlayerAndroid::canEnterFullscreen() const { 1549 bool WebMediaPlayerAndroid::canEnterFullscreen() const {
1549 return manager_->CanEnterFullscreen(frame_); 1550 return manager_->CanEnterFullscreen(frame_);
1550 } 1551 }
1551 1552
1552 } // namespace content 1553 } // namespace content
OLDNEW
« no previous file with comments | « content/common/media/video_capture_messages.h ('k') | content/renderer/media/rtc_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698