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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 } | 580 } |
581 | 581 |
582 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( | 582 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
583 blink::WebGraphicsContext3D* web_graphics_context, | 583 blink::WebGraphicsContext3D* web_graphics_context, |
584 unsigned int texture, | 584 unsigned int texture, |
585 unsigned int level, | 585 unsigned int level, |
586 unsigned int internal_format, | 586 unsigned int internal_format, |
587 unsigned int type, | 587 unsigned int type, |
588 bool premultiply_alpha, | 588 bool premultiply_alpha, |
589 bool flip_y) { | 589 bool flip_y) { |
590 return copyVideoTextureToPlatformTexture(web_graphics_context, texture, | |
591 internal_format, type, | |
592 premultiply_alpha, flip_y); | |
593 } | |
594 | |
595 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( | |
596 blink::WebGraphicsContext3D* web_graphics_context, | |
597 unsigned int texture, | |
598 unsigned int internal_format, | |
599 unsigned int type, | |
600 bool premultiply_alpha, | |
601 bool flip_y) { | |
602 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 590 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
603 | 591 |
604 scoped_refptr<VideoFrame> video_frame = | 592 scoped_refptr<VideoFrame> video_frame = |
605 GetCurrentFrameFromCompositor(); | 593 GetCurrentFrameFromCompositor(); |
606 | 594 |
607 if (!video_frame.get() || | 595 if (!video_frame.get() || |
608 video_frame->format() != VideoFrame::NATIVE_TEXTURE) { | 596 video_frame->format() != VideoFrame::NATIVE_TEXTURE) { |
609 return false; | 597 return false; |
610 } | 598 } |
611 | 599 |
612 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to | 600 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to |
613 // GLES2Interface. | 601 // GLES2Interface. |
614 gpu::gles2::GLES2Interface* gl = | 602 gpu::gles2::GLES2Interface* gl = |
615 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) | 603 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) |
616 ->GetGLInterface(); | 604 ->GetGLInterface(); |
617 SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture( | 605 SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture( |
618 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, | 606 gl, video_frame.get(), texture, level, internal_format, type, |
619 flip_y); | 607 premultiply_alpha, flip_y); |
620 return true; | 608 return true; |
621 } | 609 } |
622 | 610 |
623 WebMediaPlayer::MediaKeyException | 611 WebMediaPlayer::MediaKeyException |
624 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system, | 612 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system, |
625 const unsigned char* init_data, | 613 const unsigned char* init_data, |
626 unsigned init_data_length) { | 614 unsigned init_data_length) { |
627 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 615 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
628 | 616 |
629 return encrypted_media_support_.GenerateKeyRequest( | 617 return encrypted_media_support_.GenerateKeyRequest( |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 | 999 |
1012 // pause() may be called after playback has ended and the HTMLMediaElement | 1000 // pause() may be called after playback has ended and the HTMLMediaElement |
1013 // requires that currentTime() == duration() after ending. We want to ensure | 1001 // requires that currentTime() == duration() after ending. We want to ensure |
1014 // |paused_time_| matches currentTime() in this case or a future seek() may | 1002 // |paused_time_| matches currentTime() in this case or a future seek() may |
1015 // incorrectly discard what it thinks is a seek to the existing time. | 1003 // incorrectly discard what it thinks is a seek to the existing time. |
1016 paused_time_ = | 1004 paused_time_ = |
1017 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 1005 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
1018 } | 1006 } |
1019 | 1007 |
1020 } // namespace media | 1008 } // namespace media |
OLD | NEW |