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

Side by Side Diff: content/renderer/media/webmediaplayer_impl.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
« no previous file with comments | « content/renderer/media/video_capture_message_filter.cc ('k') | media/base/video_frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/webmediaplayer_impl.h" 5 #include "content/renderer/media/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 bool flip_y) { 628 bool flip_y) {
629 scoped_refptr<media::VideoFrame> video_frame = compositor_.GetCurrentFrame(); 629 scoped_refptr<media::VideoFrame> video_frame = compositor_.GetCurrentFrame();
630 630
631 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); 631 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture");
632 632
633 if (!video_frame) 633 if (!video_frame)
634 return false; 634 return false;
635 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) 635 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE)
636 return false; 636 return false;
637 637
638 gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); 638 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder();
639 if (mailbox_holder->texture_target != GL_TEXTURE_2D) 639 if (mailbox_holder->texture_target != GL_TEXTURE_2D)
640 return false; 640 return false;
641 641
642 // Since this method changes which texture is bound to the TEXTURE_2D target, 642 // Since this method changes which texture is bound to the TEXTURE_2D target,
643 // ideally it would restore the currently-bound texture before returning. 643 // ideally it would restore the currently-bound texture before returning.
644 // The cost of getIntegerv is sufficiently high, however, that we want to 644 // The cost of getIntegerv is sufficiently high, however, that we want to
645 // avoid it in user builds. As a result assume (below) that |texture| is 645 // avoid it in user builds. As a result assume (below) that |texture| is
646 // bound when this method is called, and only verify this fact when 646 // bound when this method is called, and only verify this fact when
647 // DCHECK_IS_ON. 647 // DCHECK_IS_ON.
648 #if DCHECK_IS_ON 648 #if DCHECK_IS_ON
(...skipping 26 matching lines...) Expand all
675 type); 675 type);
676 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); 676 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
677 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 677 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
678 false); 678 false);
679 679
680 // Restore the state for TEXTURE_2D binding point as mentioned above. 680 // Restore the state for TEXTURE_2D binding point as mentioned above.
681 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); 681 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture);
682 682
683 web_graphics_context->deleteTexture(source_texture); 683 web_graphics_context->deleteTexture(source_texture);
684 web_graphics_context->flush(); 684 web_graphics_context->flush();
685 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint());
685 return true; 686 return true;
686 } 687 }
687 688
688 // Helper functions to report media EME related stats to UMA. They follow the 689 // Helper functions to report media EME related stats to UMA. They follow the
689 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and 690 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and
690 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is 691 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is
691 // that UMA_* macros require the names to be constant throughout the process' 692 // that UMA_* macros require the names to be constant throughout the process'
692 // lifetime. 693 // lifetime.
693 static void EmeUMAHistogramEnumeration(const std::string& key_system, 694 static void EmeUMAHistogramEnumeration(const std::string& key_system,
694 const std::string& method, 695 const std::string& method,
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 1341
1341 if (web_cdm_) { 1342 if (web_cdm_) {
1342 decryptor_ready_cb.Run(web_cdm_->GetDecryptor()); 1343 decryptor_ready_cb.Run(web_cdm_->GetDecryptor());
1343 return; 1344 return;
1344 } 1345 }
1345 1346
1346 decryptor_ready_cb_ = decryptor_ready_cb; 1347 decryptor_ready_cb_ = decryptor_ready_cb;
1347 } 1348 }
1348 1349
1349 } // namespace content 1350 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/video_capture_message_filter.cc ('k') | media/base/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698