| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); | 422 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); |
| 423 DCHECK(thread_checker_.CalledOnValidThread()); | 423 DCHECK(thread_checker_.CalledOnValidThread()); |
| 424 | 424 |
| 425 scoped_refptr<media::VideoFrame> video_frame; | 425 scoped_refptr<media::VideoFrame> video_frame; |
| 426 { | 426 { |
| 427 base::AutoLock auto_lock(current_frame_lock_); | 427 base::AutoLock auto_lock(current_frame_lock_); |
| 428 video_frame = current_frame_; | 428 video_frame = current_frame_; |
| 429 } | 429 } |
| 430 | 430 |
| 431 if (!video_frame.get() || | 431 if (!video_frame.get() || |
| 432 video_frame->storage_type() != media::VideoFrame::STORAGE_TEXTURE) { | 432 video_frame->storage_type() != media::VideoFrame::STORAGE_TEXTURE || |
| 433 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { |
| 433 return false; | 434 return false; |
| 434 } | 435 } |
| 435 | 436 |
| 436 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to | 437 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to |
| 437 // GLES2Interface. | 438 // GLES2Interface. |
| 438 gpu::gles2::GLES2Interface* gl = | 439 gpu::gles2::GLES2Interface* gl = |
| 439 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) | 440 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) |
| 440 ->GetGLInterface(); | 441 ->GetGLInterface(); |
| 441 media::SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture( | 442 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( |
| 442 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, | 443 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, |
| 443 flip_y); | 444 flip_y); |
| 444 return true; | 445 return true; |
| 445 } | 446 } |
| 446 | 447 |
| 447 void WebMediaPlayerMS::SetVideoFrameProviderClient( | 448 void WebMediaPlayerMS::SetVideoFrameProviderClient( |
| 448 cc::VideoFrameProvider::Client* client) { | 449 cc::VideoFrameProvider::Client* client) { |
| 449 // This is called from both the main renderer thread and the compositor | 450 // This is called from both the main renderer thread and the compositor |
| 450 // thread (when the main thread is blocked). | 451 // thread (when the main thread is blocked). |
| 451 if (video_frame_provider_client_) | 452 if (video_frame_provider_client_) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 GetClient()->readyStateChanged(); | 554 GetClient()->readyStateChanged(); |
| 554 } | 555 } |
| 555 | 556 |
| 556 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { | 557 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { |
| 557 DCHECK(thread_checker_.CalledOnValidThread()); | 558 DCHECK(thread_checker_.CalledOnValidThread()); |
| 558 DCHECK(client_); | 559 DCHECK(client_); |
| 559 return client_; | 560 return client_; |
| 560 } | 561 } |
| 561 | 562 |
| 562 } // namespace content | 563 } // namespace content |
| OLD | NEW |