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 16 matching lines...) Expand all Loading... |
27 #include "content/renderer/media/webaudiosourceprovider_impl.h" | 27 #include "content/renderer/media/webaudiosourceprovider_impl.h" |
28 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" | 28 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
29 #include "content/renderer/media/webinbandtexttrack_impl.h" | 29 #include "content/renderer/media/webinbandtexttrack_impl.h" |
30 #include "content/renderer/media/webmediaplayer_delegate.h" | 30 #include "content/renderer/media/webmediaplayer_delegate.h" |
31 #include "content/renderer/media/webmediaplayer_params.h" | 31 #include "content/renderer/media/webmediaplayer_params.h" |
32 #include "content/renderer/media/webmediaplayer_util.h" | 32 #include "content/renderer/media/webmediaplayer_util.h" |
33 #include "content/renderer/media/webmediasource_impl.h" | 33 #include "content/renderer/media/webmediasource_impl.h" |
34 #include "content/renderer/pepper/pepper_webplugin_impl.h" | 34 #include "content/renderer/pepper/pepper_webplugin_impl.h" |
35 #include "content/renderer/render_thread_impl.h" | 35 #include "content/renderer/render_thread_impl.h" |
36 #include "gpu/GLES2/gl2extchromium.h" | 36 #include "gpu/GLES2/gl2extchromium.h" |
| 37 #include "gpu/command_buffer/common/mailbox_holder.h" |
37 #include "media/audio/null_audio_sink.h" | 38 #include "media/audio/null_audio_sink.h" |
38 #include "media/base/bind_to_current_loop.h" | 39 #include "media/base/bind_to_current_loop.h" |
39 #include "media/base/filter_collection.h" | 40 #include "media/base/filter_collection.h" |
40 #include "media/base/limits.h" | 41 #include "media/base/limits.h" |
41 #include "media/base/media_log.h" | 42 #include "media/base/media_log.h" |
42 #include "media/base/media_switches.h" | 43 #include "media/base/media_switches.h" |
43 #include "media/base/pipeline.h" | 44 #include "media/base/pipeline.h" |
44 #include "media/base/text_renderer.h" | 45 #include "media/base/text_renderer.h" |
45 #include "media/base/video_frame.h" | 46 #include "media/base/video_frame.h" |
46 #include "media/filters/audio_renderer_impl.h" | 47 #include "media/filters/audio_renderer_impl.h" |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 base::AutoLock auto_lock(lock_); | 623 base::AutoLock auto_lock(lock_); |
623 video_frame = current_frame_; | 624 video_frame = current_frame_; |
624 } | 625 } |
625 | 626 |
626 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 627 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
627 | 628 |
628 if (!video_frame) | 629 if (!video_frame) |
629 return false; | 630 return false; |
630 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) | 631 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) |
631 return false; | 632 return false; |
632 if (video_frame->texture_target() != GL_TEXTURE_2D) | 633 |
| 634 gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); |
| 635 if (mailbox_holder->texture_target != GL_TEXTURE_2D) |
633 return false; | 636 return false; |
634 | 637 |
635 // Since this method changes which texture is bound to the TEXTURE_2D target, | 638 // Since this method changes which texture is bound to the TEXTURE_2D target, |
636 // ideally it would restore the currently-bound texture before returning. | 639 // ideally it would restore the currently-bound texture before returning. |
637 // The cost of getIntegerv is sufficiently high, however, that we want to | 640 // The cost of getIntegerv is sufficiently high, however, that we want to |
638 // avoid it in user builds. As a result assume (below) that |texture| is | 641 // avoid it in user builds. As a result assume (below) that |texture| is |
639 // bound when this method is called, and only verify this fact when | 642 // bound when this method is called, and only verify this fact when |
640 // DCHECK_IS_ON. | 643 // DCHECK_IS_ON. |
641 if (DCHECK_IS_ON()) { | 644 if (DCHECK_IS_ON()) { |
642 GLint bound_texture = 0; | 645 GLint bound_texture = 0; |
643 web_graphics_context->getIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); | 646 web_graphics_context->getIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); |
644 DCHECK_EQ(static_cast<GLuint>(bound_texture), texture); | 647 DCHECK_EQ(static_cast<GLuint>(bound_texture), texture); |
645 } | 648 } |
646 | 649 |
647 media::VideoFrame::MailboxHolder* mailbox_holder = | |
648 video_frame->texture_mailbox(); | |
649 | |
650 uint32 source_texture = web_graphics_context->createTexture(); | 650 uint32 source_texture = web_graphics_context->createTexture(); |
651 | 651 |
652 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point()); | 652 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point); |
653 web_graphics_context->bindTexture(GL_TEXTURE_2D, source_texture); | 653 web_graphics_context->bindTexture(GL_TEXTURE_2D, source_texture); |
654 web_graphics_context->consumeTextureCHROMIUM(GL_TEXTURE_2D, | 654 web_graphics_context->consumeTextureCHROMIUM(GL_TEXTURE_2D, |
655 mailbox_holder->mailbox().name); | 655 mailbox_holder->mailbox.name); |
656 | 656 |
657 // The video is stored in a unmultiplied format, so premultiply | 657 // The video is stored in a unmultiplied format, so premultiply |
658 // if necessary. | 658 // if necessary. |
659 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 659 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
660 premultiply_alpha); | 660 premultiply_alpha); |
661 // Application itself needs to take care of setting the right flip_y | 661 // Application itself needs to take care of setting the right flip_y |
662 // value down to get the expected result. | 662 // value down to get the expected result. |
663 // flip_y==true means to reverse the video orientation while | 663 // flip_y==true means to reverse the video orientation while |
664 // flip_y==false means to keep the intrinsic orientation. | 664 // flip_y==false means to keep the intrinsic orientation. |
665 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); | 665 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 // The |current_frame_| wasn't painted, it is being replaced, and we haven't | 1317 // The |current_frame_| wasn't painted, it is being replaced, and we haven't |
1318 // even gotten the chance to request a repaint for it yet. Mark it as dropped. | 1318 // even gotten the chance to request a repaint for it yet. Mark it as dropped. |
1319 TRACE_EVENT0("media", "WebMediaPlayerImpl:frameDropped"); | 1319 TRACE_EVENT0("media", "WebMediaPlayerImpl:frameDropped"); |
1320 DVLOG(1) << "Frame dropped before being painted: " | 1320 DVLOG(1) << "Frame dropped before being painted: " |
1321 << current_frame_->GetTimestamp().InSecondsF(); | 1321 << current_frame_->GetTimestamp().InSecondsF(); |
1322 if (frames_dropped_before_paint_ < kuint32max) | 1322 if (frames_dropped_before_paint_ < kuint32max) |
1323 frames_dropped_before_paint_++; | 1323 frames_dropped_before_paint_++; |
1324 } | 1324 } |
1325 | 1325 |
1326 } // namespace content | 1326 } // namespace content |
OLD | NEW |