| 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 "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 } | 593 } |
| 594 | 594 |
| 595 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( | 595 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
| 596 blink::WebGraphicsContext3D* web_graphics_context, | 596 blink::WebGraphicsContext3D* web_graphics_context, |
| 597 unsigned int texture, | 597 unsigned int texture, |
| 598 unsigned int level, | 598 unsigned int level, |
| 599 unsigned int internal_format, | 599 unsigned int internal_format, |
| 600 unsigned int type, | 600 unsigned int type, |
| 601 bool premultiply_alpha, | 601 bool premultiply_alpha, |
| 602 bool flip_y) { | 602 bool flip_y) { |
| 603 return copyVideoTextureToPlatformTexture(web_graphics_context, texture, |
| 604 internal_format, type, |
| 605 premultiply_alpha, flip_y); |
| 606 } |
| 607 |
| 608 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
| 609 blink::WebGraphicsContext3D* web_graphics_context, |
| 610 unsigned int texture, |
| 611 unsigned int internal_format, |
| 612 unsigned int type, |
| 613 bool premultiply_alpha, |
| 614 bool flip_y) { |
| 603 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 615 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
| 604 | 616 |
| 605 scoped_refptr<VideoFrame> video_frame = | 617 scoped_refptr<VideoFrame> video_frame = |
| 606 GetCurrentFrameFromCompositor(); | 618 GetCurrentFrameFromCompositor(); |
| 607 | 619 |
| 608 if (!video_frame.get() || | 620 if (!video_frame.get() || |
| 609 video_frame->format() != VideoFrame::NATIVE_TEXTURE) { | 621 video_frame->format() != VideoFrame::NATIVE_TEXTURE) { |
| 610 return false; | 622 return false; |
| 611 } | 623 } |
| 612 | 624 |
| 613 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to | 625 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to |
| 614 // GLES2Interface. | 626 // GLES2Interface. |
| 615 gpu::gles2::GLES2Interface* gl = | 627 gpu::gles2::GLES2Interface* gl = |
| 616 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) | 628 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) |
| 617 ->GetGLInterface(); | 629 ->GetGLInterface(); |
| 618 SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture( | 630 SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture( |
| 619 gl, video_frame.get(), texture, level, internal_format, type, | 631 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, |
| 620 premultiply_alpha, flip_y); | 632 flip_y); |
| 621 return true; | 633 return true; |
| 622 } | 634 } |
| 623 | 635 |
| 624 WebMediaPlayer::MediaKeyException | 636 WebMediaPlayer::MediaKeyException |
| 625 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system, | 637 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system, |
| 626 const unsigned char* init_data, | 638 const unsigned char* init_data, |
| 627 unsigned init_data_length) { | 639 unsigned init_data_length) { |
| 628 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 640 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 629 | 641 |
| 630 return encrypted_media_support_.GenerateKeyRequest( | 642 return encrypted_media_support_.GenerateKeyRequest( |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 | 1035 |
| 1024 // pause() may be called after playback has ended and the HTMLMediaElement | 1036 // pause() may be called after playback has ended and the HTMLMediaElement |
| 1025 // requires that currentTime() == duration() after ending. We want to ensure | 1037 // requires that currentTime() == duration() after ending. We want to ensure |
| 1026 // |paused_time_| matches currentTime() in this case or a future seek() may | 1038 // |paused_time_| matches currentTime() in this case or a future seek() may |
| 1027 // incorrectly discard what it thinks is a seek to the existing time. | 1039 // incorrectly discard what it thinks is a seek to the existing time. |
| 1028 paused_time_ = | 1040 paused_time_ = |
| 1029 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 1041 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
| 1030 } | 1042 } |
| 1031 | 1043 |
| 1032 } // namespace media | 1044 } // namespace media |
| OLD | NEW |