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

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: Add WaitSyncPoint in WMPImpl::paint(...) Created 6 years, 9 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/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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 // are exceptions such as webgl where compositing is used in the WebView but 528 // are exceptions such as webgl where compositing is used in the WebView but
529 // video frames are still rendered to a canvas. 529 // video frames are still rendered to a canvas.
530 UMA_HISTOGRAM_BOOLEAN( 530 UMA_HISTOGRAM_BOOLEAN(
531 "Media.AcceleratedCompositingActive", 531 "Media.AcceleratedCompositingActive",
532 frame_->view()->isAcceleratedCompositingActive()); 532 frame_->view()->isAcceleratedCompositingActive());
533 } 533 }
534 534
535 535
536 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); 536 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint");
537 scoped_refptr<media::VideoFrame> video_frame = painter_.GetCurrentFrame(true); 537 scoped_refptr<media::VideoFrame> video_frame = painter_.GetCurrentFrame(true);
538 if (video_frame &&
539 video_frame->format() == media::VideoFrame::NATIVE_TEXTURE) {
540 DCHECK(gpu_factories_);
541 gpu_factories_->WaitSyncPoint(video_frame->mailbox_holder()->sync_point);
542 }
538 gfx::Rect gfx_rect(rect); 543 gfx::Rect gfx_rect(rect);
539 skcanvas_video_renderer_.Paint(video_frame.get(), canvas, gfx_rect, alpha); 544 skcanvas_video_renderer_.Paint(video_frame.get(), canvas, gfx_rect, alpha);
545 if (video_frame &&
546 video_frame->format() == media::VideoFrame::NATIVE_TEXTURE) {
547 DCHECK(gpu_factories_);
548 uint32 previous_sync_point =
549 video_frame->SwapReleaseSyncPoint(gpu_factories_->InsertSyncPoint());
550 if (previous_sync_point)
551 gpu_factories_->WaitSyncPoint(previous_sync_point);
552 }
540 } 553 }
541 554
542 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { 555 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const {
543 if (data_source_) 556 if (data_source_)
544 return data_source_->HasSingleOrigin(); 557 return data_source_->HasSingleOrigin();
545 return true; 558 return true;
546 } 559 }
547 560
548 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { 561 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const {
549 if (data_source_) 562 if (data_source_)
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 false); 689 false);
677 690
678 // Restore the state for TEXTURE_2D binding point as mentioned above. 691 // Restore the state for TEXTURE_2D binding point as mentioned above.
679 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); 692 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture);
680 693
681 web_graphics_context->deleteTexture(source_texture); 694 web_graphics_context->deleteTexture(source_texture);
682 695
683 // The flush() operation is not necessary here. It is kept since the 696 // The flush() operation is not necessary here. It is kept since the
684 // performance will be better when it is added than not. 697 // performance will be better when it is added than not.
685 web_graphics_context->flush(); 698 web_graphics_context->flush();
699 uint32 previous_sync_point = video_frame->SwapReleaseSyncPoint(
700 web_graphics_context->insertSyncPoint());
701 if (previous_sync_point)
702 web_graphics_context->waitSyncPoint(previous_sync_point);
686 return true; 703 return true;
687 } 704 }
688 705
689 // Helper functions to report media EME related stats to UMA. They follow the 706 // Helper functions to report media EME related stats to UMA. They follow the
690 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and 707 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and
691 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is 708 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is
692 // that UMA_* macros require the names to be constant throughout the process' 709 // that UMA_* macros require the names to be constant throughout the process'
693 // lifetime. 710 // lifetime.
694 static void EmeUMAHistogramEnumeration(const std::string& key_system, 711 static void EmeUMAHistogramEnumeration(const std::string& key_system,
695 const std::string& method, 712 const std::string& method,
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 1333
1317 if (web_cdm_) { 1334 if (web_cdm_) {
1318 decryptor_ready_cb.Run(web_cdm_->GetDecryptor()); 1335 decryptor_ready_cb.Run(web_cdm_->GetDecryptor());
1319 return; 1336 return;
1320 } 1337 }
1321 1338
1322 decryptor_ready_cb_ = decryptor_ready_cb; 1339 decryptor_ready_cb_ = decryptor_ready_cb;
1323 } 1340 }
1324 1341
1325 } // namespace content 1342 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698