| 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 <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 unsigned int texture, | 589 unsigned int texture, |
| 590 unsigned int internal_format, | 590 unsigned int internal_format, |
| 591 unsigned int type, | 591 unsigned int type, |
| 592 bool premultiply_alpha, | 592 bool premultiply_alpha, |
| 593 bool flip_y) { | 593 bool flip_y) { |
| 594 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 594 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
| 595 | 595 |
| 596 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 596 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
| 597 | 597 |
| 598 if (!video_frame.get() || | 598 if (!video_frame.get() || |
| 599 video_frame->storage_type() != VideoFrame::STORAGE_TEXTURE) { | 599 video_frame->storage_type() != VideoFrame::STORAGE_TEXTURE || |
| 600 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { |
| 600 return false; | 601 return false; |
| 601 } | 602 } |
| 602 | 603 |
| 603 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to | 604 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to |
| 604 // GLES2Interface. | 605 // GLES2Interface. |
| 605 gpu::gles2::GLES2Interface* gl = | 606 gpu::gles2::GLES2Interface* gl = |
| 606 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) | 607 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) |
| 607 ->GetGLInterface(); | 608 ->GetGLInterface(); |
| 608 SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture( | 609 SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( |
| 609 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, | 610 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, |
| 610 flip_y); | 611 flip_y); |
| 611 return true; | 612 return true; |
| 612 } | 613 } |
| 613 | 614 |
| 614 WebMediaPlayer::MediaKeyException | 615 WebMediaPlayer::MediaKeyException |
| 615 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system, | 616 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system, |
| 616 const unsigned char* init_data, | 617 const unsigned char* init_data, |
| 617 unsigned init_data_length) { | 618 unsigned init_data_length) { |
| 618 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 619 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 | 1009 |
| 1009 // pause() may be called after playback has ended and the HTMLMediaElement | 1010 // pause() may be called after playback has ended and the HTMLMediaElement |
| 1010 // requires that currentTime() == duration() after ending. We want to ensure | 1011 // requires that currentTime() == duration() after ending. We want to ensure |
| 1011 // |paused_time_| matches currentTime() in this case or a future seek() may | 1012 // |paused_time_| matches currentTime() in this case or a future seek() may |
| 1012 // incorrectly discard what it thinks is a seek to the existing time. | 1013 // incorrectly discard what it thinks is a seek to the existing time. |
| 1013 paused_time_ = | 1014 paused_time_ = |
| 1014 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 1015 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
| 1015 } | 1016 } |
| 1016 | 1017 |
| 1017 } // namespace media | 1018 } // namespace media |
| OLD | NEW |