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

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

Issue 371463009: Making use of bindless variants mailbox produce/consume on remainders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cc tests Created 6 years, 5 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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // The cost of getIntegerv is sufficiently high, however, that we want to 614 // The cost of getIntegerv is sufficiently high, however, that we want to
615 // avoid it in user builds. As a result assume (below) that |texture| is 615 // avoid it in user builds. As a result assume (below) that |texture| is
616 // bound when this method is called, and only verify this fact when 616 // bound when this method is called, and only verify this fact when
617 // DCHECK_IS_ON. 617 // DCHECK_IS_ON.
618 #if DCHECK_IS_ON 618 #if DCHECK_IS_ON
619 GLint bound_texture = 0; 619 GLint bound_texture = 0;
620 web_graphics_context->getIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); 620 web_graphics_context->getIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture);
621 DCHECK_EQ(static_cast<GLuint>(bound_texture), texture); 621 DCHECK_EQ(static_cast<GLuint>(bound_texture), texture);
622 #endif 622 #endif
623 623
624 uint32 source_texture = web_graphics_context->createTexture();
625
626 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point); 624 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point);
627 web_graphics_context->bindTexture(GL_TEXTURE_2D, source_texture); 625 uint32 source_texture = web_graphics_context->createAndConsumeTextureCHROMIUM(
628 web_graphics_context->consumeTextureCHROMIUM(GL_TEXTURE_2D, 626 GL_TEXTURE_2D, mailbox_holder->mailbox.name);
629 mailbox_holder->mailbox.name);
630 627
631 // The video is stored in a unmultiplied format, so premultiply 628 // The video is stored in a unmultiplied format, so premultiply
632 // if necessary. 629 // if necessary.
633 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 630 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
634 premultiply_alpha); 631 premultiply_alpha);
635 // Application itself needs to take care of setting the right flip_y 632 // Application itself needs to take care of setting the right flip_y
636 // value down to get the expected result. 633 // value down to get the expected result.
637 // flip_y==true means to reverse the video orientation while 634 // flip_y==true means to reverse the video orientation while
638 // flip_y==false means to keep the intrinsic orientation. 635 // flip_y==false means to keep the intrinsic orientation.
639 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); 636 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y);
640 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, 637 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D,
641 source_texture, 638 source_texture,
642 texture, 639 texture,
643 level, 640 level,
644 internal_format, 641 internal_format,
645 type); 642 type);
646 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); 643 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
647 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 644 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
648 false); 645 false);
649 646
650 // Restore the state for TEXTURE_2D binding point as mentioned above.
651 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture);
652
653 web_graphics_context->deleteTexture(source_texture); 647 web_graphics_context->deleteTexture(source_texture);
654 web_graphics_context->flush(); 648 web_graphics_context->flush();
655 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint()); 649 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint());
656 return true; 650 return true;
657 } 651 }
658 652
659 // Helper functions to report media EME related stats to UMA. They follow the 653 // Helper functions to report media EME related stats to UMA. They follow the
660 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and 654 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and
661 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is 655 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is
662 // that UMA_* macros require the names to be constant throughout the process' 656 // that UMA_* macros require the names to be constant throughout the process'
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 compositor_task_runner_->PostTask(FROM_HERE, 1355 compositor_task_runner_->PostTask(FROM_HERE,
1362 base::Bind(&GetCurrentFrameAndSignal, 1356 base::Bind(&GetCurrentFrameAndSignal,
1363 base::Unretained(compositor_), 1357 base::Unretained(compositor_),
1364 &video_frame, 1358 &video_frame,
1365 &event)); 1359 &event));
1366 event.Wait(); 1360 event.Wait();
1367 return video_frame; 1361 return video_frame;
1368 } 1362 }
1369 1363
1370 } // namespace content 1364 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | content/renderer/pepper/video_decoder_shim.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698