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