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

Side by Side Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cc2a95fe Android fixes. Created 7 years 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 | Annotate | Revision Log
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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 base::AutoLock auto_lock(lock_); 630 base::AutoLock auto_lock(lock_);
631 video_frame = current_frame_; 631 video_frame = current_frame_;
632 } 632 }
633 633
634 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); 634 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture");
635 635
636 if (!video_frame) 636 if (!video_frame)
637 return false; 637 return false;
638 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) 638 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE)
639 return false; 639 return false;
640 if (video_frame->texture_target() != GL_TEXTURE_2D) 640
641 gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder();
642 if (mailbox_holder->target() != GL_TEXTURE_2D)
641 return false; 643 return false;
642 644
643 // Since this method changes which texture is bound to the TEXTURE_2D target, 645 // Since this method changes which texture is bound to the TEXTURE_2D target,
644 // ideally it would restore the currently-bound texture before returning. 646 // ideally it would restore the currently-bound texture before returning.
645 // The cost of getIntegerv is sufficiently high, however, that we want to 647 // The cost of getIntegerv is sufficiently high, however, that we want to
646 // avoid it in user builds. As a result assume (below) that |texture| is 648 // avoid it in user builds. As a result assume (below) that |texture| is
647 // bound when this method is called, and only verify this fact when 649 // bound when this method is called, and only verify this fact when
648 // DCHECK_IS_ON. 650 // DCHECK_IS_ON.
649 if (DCHECK_IS_ON()) { 651 if (DCHECK_IS_ON()) {
650 GLint bound_texture = 0; 652 GLint bound_texture = 0;
651 web_graphics_context->getIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); 653 web_graphics_context->getIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture);
652 DCHECK_EQ(static_cast<GLuint>(bound_texture), texture); 654 DCHECK_EQ(static_cast<GLuint>(bound_texture), texture);
653 } 655 }
654 656
655 media::VideoFrame::MailboxHolder* mailbox_holder =
656 video_frame->texture_mailbox();
657
658 uint32 source_texture = web_graphics_context->createTexture(); 657 uint32 source_texture = web_graphics_context->createTexture();
659 658
660 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point()); 659 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point());
661 web_graphics_context->bindTexture(GL_TEXTURE_2D, source_texture); 660 web_graphics_context->bindTexture(GL_TEXTURE_2D, source_texture);
662 web_graphics_context->consumeTextureCHROMIUM(GL_TEXTURE_2D, 661 web_graphics_context->consumeTextureCHROMIUM(GL_TEXTURE_2D,
663 mailbox_holder->mailbox().name); 662 mailbox_holder->mailbox().name);
664 663
665 // The video is stored in a unmultiplied format, so premultiply 664 // The video is stored in a unmultiplied format, so premultiply
666 // if necessary. 665 // if necessary.
667 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 666 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 // The |current_frame_| wasn't painted, it is being replaced, and we haven't 1321 // The |current_frame_| wasn't painted, it is being replaced, and we haven't
1323 // even gotten the chance to request a repaint for it yet. Mark it as dropped. 1322 // even gotten the chance to request a repaint for it yet. Mark it as dropped.
1324 TRACE_EVENT0("media", "WebMediaPlayerImpl:frameDropped"); 1323 TRACE_EVENT0("media", "WebMediaPlayerImpl:frameDropped");
1325 DVLOG(1) << "Frame dropped before being painted: " 1324 DVLOG(1) << "Frame dropped before being painted: "
1326 << current_frame_->GetTimestamp().InSecondsF(); 1325 << current_frame_->GetTimestamp().InSecondsF();
1327 if (frames_dropped_before_paint_ < kuint32max) 1326 if (frames_dropped_before_paint_ < kuint32max)
1328 frames_dropped_before_paint_++; 1327 frames_dropped_before_paint_++;
1329 } 1328 }
1330 1329
1331 } // namespace content 1330 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698