| 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_ms.h" | 5 #include "content/renderer/media/webmediaplayer_ms.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 // TODO(perkj, magjed): See TODO in OnPlay(). | 570 // TODO(perkj, magjed): See TODO in OnPlay(). |
| 571 } | 571 } |
| 572 | 572 |
| 573 void WebMediaPlayerMS::OnBecamePersistentVideo(bool value) { | 573 void WebMediaPlayerMS::OnBecamePersistentVideo(bool value) { |
| 574 get_client()->onBecamePersistentVideo(value); | 574 get_client()->onBecamePersistentVideo(value); |
| 575 } | 575 } |
| 576 | 576 |
| 577 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( | 577 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( |
| 578 gpu::gles2::GLES2Interface* gl, | 578 gpu::gles2::GLES2Interface* gl, |
| 579 unsigned int texture, | 579 unsigned int texture, |
| 580 unsigned internal_format, |
| 581 unsigned type, |
| 580 bool premultiply_alpha, | 582 bool premultiply_alpha, |
| 581 bool flip_y) { | 583 bool flip_y) { |
| 582 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); | 584 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); |
| 583 DCHECK(thread_checker_.CalledOnValidThread()); | 585 DCHECK(thread_checker_.CalledOnValidThread()); |
| 584 | 586 |
| 585 scoped_refptr<media::VideoFrame> video_frame = | 587 scoped_refptr<media::VideoFrame> video_frame = |
| 586 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); | 588 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); |
| 587 | 589 |
| 588 if (!video_frame.get() || !video_frame->HasTextures()) | 590 if (!video_frame.get() || !video_frame->HasTextures()) |
| 589 return false; | 591 return false; |
| 590 | 592 |
| 591 media::Context3D context_3d; | 593 media::Context3D context_3d; |
| 592 auto* provider = | 594 auto* provider = |
| 593 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 595 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 594 // GPU Process crashed. | 596 // GPU Process crashed. |
| 595 if (!provider) | 597 if (!provider) |
| 596 return false; | 598 return false; |
| 597 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); | 599 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); |
| 598 DCHECK(context_3d.gl); | 600 DCHECK(context_3d.gl); |
| 599 return video_renderer_.CopyVideoFrameTexturesToGLTexture( | 601 return video_renderer_.CopyVideoFrameTexturesToGLTexture( |
| 600 context_3d, gl, video_frame.get(), texture, premultiply_alpha, flip_y); | 602 context_3d, gl, video_frame.get(), texture, internal_format, type, |
| 603 premultiply_alpha, flip_y); |
| 601 } | 604 } |
| 602 | 605 |
| 603 bool WebMediaPlayerMS::texImageImpl(TexImageFunctionID functionID, | 606 bool WebMediaPlayerMS::texImageImpl(TexImageFunctionID functionID, |
| 604 unsigned target, | 607 unsigned target, |
| 605 gpu::gles2::GLES2Interface* gl, | 608 gpu::gles2::GLES2Interface* gl, |
| 606 int level, | 609 int level, |
| 607 int internalformat, | 610 int internalformat, |
| 608 unsigned format, | 611 unsigned format, |
| 609 unsigned type, | 612 unsigned type, |
| 610 int xoffset, | 613 int xoffset, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 void WebMediaPlayerMS::ResetCanvasCache() { | 705 void WebMediaPlayerMS::ResetCanvasCache() { |
| 703 DCHECK(thread_checker_.CalledOnValidThread()); | 706 DCHECK(thread_checker_.CalledOnValidThread()); |
| 704 video_renderer_.ResetCache(); | 707 video_renderer_.ResetCache(); |
| 705 } | 708 } |
| 706 | 709 |
| 707 void WebMediaPlayerMS::TriggerResize() { | 710 void WebMediaPlayerMS::TriggerResize() { |
| 708 get_client()->sizeChanged(); | 711 get_client()->sizeChanged(); |
| 709 } | 712 } |
| 710 | 713 |
| 711 } // namespace content | 714 } // namespace content |
| OLD | NEW |