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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 TRACE_EVENT0("webrtc", "WebMediaPlayerMS::OnFrameAvailable"); | 485 TRACE_EVENT0("webrtc", "WebMediaPlayerMS::OnFrameAvailable"); |
487 } | 486 } |
488 | 487 |
489 if (!received_first_frame_) { | 488 if (!received_first_frame_) { |
490 received_first_frame_ = true; | 489 received_first_frame_ = true; |
491 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); | 490 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); |
492 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); | 491 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); |
493 | 492 |
494 if (video_frame_provider_.get()) { | 493 if (video_frame_provider_.get()) { |
495 video_weblayer_.reset(new cc_blink::WebLayerImpl( | 494 video_weblayer_.reset(new cc_blink::WebLayerImpl( |
496 cc::VideoLayer::Create(cc::LayerSettings(), | 495 cc::VideoLayer::Create(compositor_.get(), media::VIDEO_ROTATION_0))); |
497 compositor_.get(), media::VIDEO_ROTATION_0))); | |
498 video_weblayer_->layer()->SetContentsOpaque(false); | 496 video_weblayer_->layer()->SetContentsOpaque(false); |
499 video_weblayer_->SetContentsOpaqueIsFixed(true); | 497 video_weblayer_->SetContentsOpaqueIsFixed(true); |
500 get_client()->setWebLayer(video_weblayer_.get()); | 498 get_client()->setWebLayer(video_weblayer_.get()); |
501 } | 499 } |
502 } | 500 } |
503 | 501 |
504 // As EnqueueFrame can potentially change |current_frame_|, we need to do | 502 // As EnqueueFrame can potentially change |current_frame_|, we need to do |
505 // the size change check before it. Otherwise, we are running the risk of not | 503 // the size change check before it. Otherwise, we are running the risk of not |
506 // detecting a size change event. | 504 // detecting a size change event. |
507 const bool size_changed = | 505 const bool size_changed = |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 media::SkCanvasVideoRenderer* WebMediaPlayerMS::GetSkCanvasVideoRenderer() { | 539 media::SkCanvasVideoRenderer* WebMediaPlayerMS::GetSkCanvasVideoRenderer() { |
542 return &video_renderer_; | 540 return &video_renderer_; |
543 } | 541 } |
544 | 542 |
545 void WebMediaPlayerMS::ResetCanvasCache() { | 543 void WebMediaPlayerMS::ResetCanvasCache() { |
546 DCHECK(thread_checker_.CalledOnValidThread()); | 544 DCHECK(thread_checker_.CalledOnValidThread()); |
547 video_renderer_.ResetCache(); | 545 video_renderer_.ResetCache(); |
548 } | 546 } |
549 | 547 |
550 } // namespace content | 548 } // namespace content |
OLD | NEW |