| OLD | NEW |
| 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 609 |
| 610 if (!video_frame) | 610 if (!video_frame) |
| 611 return false; | 611 return false; |
| 612 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) | 612 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) |
| 613 return false; | 613 return false; |
| 614 | 614 |
| 615 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); | 615 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); |
| 616 if (mailbox_holder->texture_target != GL_TEXTURE_2D) | 616 if (mailbox_holder->texture_target != GL_TEXTURE_2D) |
| 617 return false; | 617 return false; |
| 618 | 618 |
| 619 // Since this method changes which texture is bound to the TEXTURE_2D target, | |
| 620 // ideally it would restore the currently-bound texture before returning. | |
| 621 // The cost of getIntegerv is sufficiently high, however, that we want to | |
| 622 // avoid it in user builds. As a result assume (below) that |texture| is | |
| 623 // bound when this method is called, and only verify this fact when | |
| 624 // DCHECK_IS_ON. | |
| 625 #if DCHECK_IS_ON | |
| 626 GLint bound_texture = 0; | |
| 627 web_graphics_context->getIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); | |
| 628 DCHECK_EQ(static_cast<GLuint>(bound_texture), texture); | |
| 629 #endif | |
| 630 | |
| 631 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point); | 619 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point); |
| 632 uint32 source_texture = web_graphics_context->createAndConsumeTextureCHROMIUM( | 620 uint32 source_texture = web_graphics_context->createAndConsumeTextureCHROMIUM( |
| 633 GL_TEXTURE_2D, mailbox_holder->mailbox.name); | 621 GL_TEXTURE_2D, mailbox_holder->mailbox.name); |
| 634 | 622 |
| 635 // The video is stored in a unmultiplied format, so premultiply | 623 // The video is stored in a unmultiplied format, so premultiply |
| 636 // if necessary. | 624 // if necessary. |
| 637 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 625 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
| 638 premultiply_alpha); | 626 premultiply_alpha); |
| 639 // Application itself needs to take care of setting the right flip_y | 627 // Application itself needs to take care of setting the right flip_y |
| 640 // value down to get the expected result. | 628 // value down to get the expected result. |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 compositor_task_runner_->PostTask(FROM_HERE, | 1325 compositor_task_runner_->PostTask(FROM_HERE, |
| 1338 base::Bind(&GetCurrentFrameAndSignal, | 1326 base::Bind(&GetCurrentFrameAndSignal, |
| 1339 base::Unretained(compositor_), | 1327 base::Unretained(compositor_), |
| 1340 &video_frame, | 1328 &video_frame, |
| 1341 &event)); | 1329 &event)); |
| 1342 event.Wait(); | 1330 event.Wait(); |
| 1343 return video_frame; | 1331 return video_frame; |
| 1344 } | 1332 } |
| 1345 | 1333 |
| 1346 } // namespace content | 1334 } // namespace content |
| OLD | NEW |