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 <stddef.h> | 7 #include <stddef.h> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "cc/blink/context_provider_web_context.h" | 15 #include "cc/blink/context_provider_web_context.h" |
16 #include "cc/blink/web_layer_impl.h" | 16 #include "cc/blink/web_layer_impl.h" |
17 #include "cc/layers/layer_settings.h" | |
18 #include "cc/layers/video_frame_provider_client_impl.h" | 17 #include "cc/layers/video_frame_provider_client_impl.h" |
19 #include "cc/layers/video_layer.h" | 18 #include "cc/layers/video_layer.h" |
20 #include "content/public/renderer/media_stream_audio_renderer.h" | 19 #include "content/public/renderer/media_stream_audio_renderer.h" |
21 #include "content/public/renderer/media_stream_renderer_factory.h" | 20 #include "content/public/renderer/media_stream_renderer_factory.h" |
22 #include "content/public/renderer/video_frame_provider.h" | 21 #include "content/public/renderer/video_frame_provider.h" |
23 #include "content/renderer/media/webmediaplayer_ms_compositor.h" | 22 #include "content/renderer/media/webmediaplayer_ms_compositor.h" |
24 #include "content/renderer/render_frame_impl.h" | 23 #include "content/renderer/render_frame_impl.h" |
25 #include "content/renderer/render_thread_impl.h" | 24 #include "content/renderer/render_thread_impl.h" |
26 #include "gpu/blink/webgraphicscontext3d_impl.h" | 25 #include "gpu/blink/webgraphicscontext3d_impl.h" |
27 #include "media/base/media_log.h" | 26 #include "media/base/media_log.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 TRACE_EVENT0("webrtc", "WebMediaPlayerMS::OnFrameAvailable"); | 490 TRACE_EVENT0("webrtc", "WebMediaPlayerMS::OnFrameAvailable"); |
492 } | 491 } |
493 | 492 |
494 if (!received_first_frame_) { | 493 if (!received_first_frame_) { |
495 received_first_frame_ = true; | 494 received_first_frame_ = true; |
496 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); | 495 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); |
497 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); | 496 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); |
498 | 497 |
499 if (video_frame_provider_.get()) { | 498 if (video_frame_provider_.get()) { |
500 video_weblayer_.reset(new cc_blink::WebLayerImpl( | 499 video_weblayer_.reset(new cc_blink::WebLayerImpl( |
501 cc::VideoLayer::Create(cc::LayerSettings(), | 500 cc::VideoLayer::Create(compositor_.get(), media::VIDEO_ROTATION_0))); |
502 compositor_.get(), media::VIDEO_ROTATION_0))); | |
503 video_weblayer_->layer()->SetContentsOpaque(false); | 501 video_weblayer_->layer()->SetContentsOpaque(false); |
504 video_weblayer_->SetContentsOpaqueIsFixed(true); | 502 video_weblayer_->SetContentsOpaqueIsFixed(true); |
505 get_client()->setWebLayer(video_weblayer_.get()); | 503 get_client()->setWebLayer(video_weblayer_.get()); |
506 } | 504 } |
507 } | 505 } |
508 | 506 |
509 // As EnqueueFrame can potentially change |current_frame_|, we need to do | 507 // As EnqueueFrame can potentially change |current_frame_|, we need to do |
510 // the size change check before it. Otherwise, we are running the risk of not | 508 // the size change check before it. Otherwise, we are running the risk of not |
511 // detecting a size change event. | 509 // detecting a size change event. |
512 const bool size_changed = | 510 const bool size_changed = |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 media::SkCanvasVideoRenderer* WebMediaPlayerMS::GetSkCanvasVideoRenderer() { | 544 media::SkCanvasVideoRenderer* WebMediaPlayerMS::GetSkCanvasVideoRenderer() { |
547 return &video_renderer_; | 545 return &video_renderer_; |
548 } | 546 } |
549 | 547 |
550 void WebMediaPlayerMS::ResetCanvasCache() { | 548 void WebMediaPlayerMS::ResetCanvasCache() { |
551 DCHECK(thread_checker_.CalledOnValidThread()); | 549 DCHECK(thread_checker_.CalledOnValidThread()); |
552 video_renderer_.ResetCache(); | 550 video_renderer_.ResetCache(); |
553 } | 551 } |
554 | 552 |
555 } // namespace content | 553 } // namespace content |
OLD | NEW |