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