| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 404 } |
| 405 | 405 |
| 406 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( | 406 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( |
| 407 blink::WebGraphicsContext3D* web_graphics_context, | 407 blink::WebGraphicsContext3D* web_graphics_context, |
| 408 unsigned int texture, | 408 unsigned int texture, |
| 409 unsigned int level, | 409 unsigned int level, |
| 410 unsigned int internal_format, | 410 unsigned int internal_format, |
| 411 unsigned int type, | 411 unsigned int type, |
| 412 bool premultiply_alpha, | 412 bool premultiply_alpha, |
| 413 bool flip_y) { | 413 bool flip_y) { |
| 414 return copyVideoTextureToPlatformTexture(web_graphics_context, texture, | |
| 415 internal_format, type, | |
| 416 premultiply_alpha, flip_y); | |
| 417 } | |
| 418 | |
| 419 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( | |
| 420 blink::WebGraphicsContext3D* web_graphics_context, | |
| 421 unsigned int texture, | |
| 422 unsigned int internal_format, | |
| 423 unsigned int type, | |
| 424 bool premultiply_alpha, | |
| 425 bool flip_y) { | |
| 426 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); | 414 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); |
| 427 DCHECK(thread_checker_.CalledOnValidThread()); | 415 DCHECK(thread_checker_.CalledOnValidThread()); |
| 428 | 416 |
| 429 scoped_refptr<media::VideoFrame> video_frame; | 417 scoped_refptr<media::VideoFrame> video_frame; |
| 430 { | 418 { |
| 431 base::AutoLock auto_lock(current_frame_lock_); | 419 base::AutoLock auto_lock(current_frame_lock_); |
| 432 video_frame = current_frame_; | 420 video_frame = current_frame_; |
| 433 } | 421 } |
| 434 | 422 |
| 435 if (!video_frame.get() || | 423 if (!video_frame.get() || |
| 436 video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) { | 424 video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) { |
| 437 return false; | 425 return false; |
| 438 } | 426 } |
| 439 | 427 |
| 440 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to | 428 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to |
| 441 // GLES2Interface. | 429 // GLES2Interface. |
| 442 gpu::gles2::GLES2Interface* gl = | 430 gpu::gles2::GLES2Interface* gl = |
| 443 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) | 431 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) |
| 444 ->GetGLInterface(); | 432 ->GetGLInterface(); |
| 445 media::SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture( | 433 media::SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture( |
| 446 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, | 434 gl, video_frame.get(), texture, level, internal_format, type, |
| 447 flip_y); | 435 premultiply_alpha, flip_y); |
| 448 return true; | 436 return true; |
| 449 } | 437 } |
| 450 | 438 |
| 451 void WebMediaPlayerMS::SetVideoFrameProviderClient( | 439 void WebMediaPlayerMS::SetVideoFrameProviderClient( |
| 452 cc::VideoFrameProvider::Client* client) { | 440 cc::VideoFrameProvider::Client* client) { |
| 453 // This is called from both the main renderer thread and the compositor | 441 // This is called from both the main renderer thread and the compositor |
| 454 // thread (when the main thread is blocked). | 442 // thread (when the main thread is blocked). |
| 455 if (video_frame_provider_client_) | 443 if (video_frame_provider_client_) |
| 456 video_frame_provider_client_->StopUsingProvider(); | 444 video_frame_provider_client_->StopUsingProvider(); |
| 457 video_frame_provider_client_ = client; | 445 video_frame_provider_client_ = client; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 GetClient()->readyStateChanged(); | 536 GetClient()->readyStateChanged(); |
| 549 } | 537 } |
| 550 | 538 |
| 551 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { | 539 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { |
| 552 DCHECK(thread_checker_.CalledOnValidThread()); | 540 DCHECK(thread_checker_.CalledOnValidThread()); |
| 553 DCHECK(client_); | 541 DCHECK(client_); |
| 554 return client_; | 542 return client_; |
| 555 } | 543 } |
| 556 | 544 |
| 557 } // namespace content | 545 } // namespace content |
| OLD | NEW |