| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/glue/webmediaplayer_impl.h" | 5 #include "webkit/glue/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "media/base/composite_data_source_factory.h" | 12 #include "media/base/composite_data_source_factory.h" |
| 13 #include "media/base/filter_collection.h" | 13 #include "media/base/filter_collection.h" |
| 14 #include "media/base/limits.h" | 14 #include "media/base/limits.h" |
| 15 #include "media/base/media_format.h" | 15 #include "media/base/media_format.h" |
| 16 #include "media/base/media_switches.h" | 16 #include "media/base/media_switches.h" |
| 17 #include "media/base/pipeline_impl.h" | 17 #include "media/base/pipeline_impl.h" |
| 18 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
| 19 #include "media/filters/adaptive_demuxer.h" | 19 #include "media/filters/adaptive_demuxer.h" |
| 20 #include "media/filters/ffmpeg_audio_decoder.h" | 20 #include "media/filters/ffmpeg_audio_decoder.h" |
| 21 #include "media/filters/ffmpeg_demuxer_factory.h" | 21 #include "media/filters/ffmpeg_demuxer_factory.h" |
| 22 #include "media/filters/ffmpeg_video_decoder.h" | 22 #include "media/filters/ffmpeg_video_decoder.h" |
| 23 #include "media/filters/rtc_video_decoder.h" | |
| 24 #include "media/filters/null_audio_renderer.h" | 23 #include "media/filters/null_audio_renderer.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" |
| 29 #include "webkit/glue/media/buffered_data_source.h" | 28 #include "webkit/glue/media/buffered_data_source.h" |
| 30 #include "webkit/glue/media/simple_data_source.h" | 29 #include "webkit/glue/media/simple_data_source.h" |
| 31 #include "webkit/glue/media/video_renderer_impl.h" | 30 #include "webkit/glue/media/video_renderer_impl.h" |
| 32 #include "webkit/glue/media/web_video_renderer.h" | 31 #include "webkit/glue/media/web_video_renderer.h" |
| 33 #include "webkit/glue/webvideoframe_impl.h" | 32 #include "webkit/glue/webvideoframe_impl.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // event. | 370 // event. |
| 372 if (main_loop_) { | 371 if (main_loop_) { |
| 373 main_loop_->RemoveDestructionObserver(this); | 372 main_loop_->RemoveDestructionObserver(this); |
| 374 } | 373 } |
| 375 } | 374 } |
| 376 | 375 |
| 377 void WebMediaPlayerImpl::load(const WebKit::WebURL& url) { | 376 void WebMediaPlayerImpl::load(const WebKit::WebURL& url) { |
| 378 DCHECK(MessageLoop::current() == main_loop_); | 377 DCHECK(MessageLoop::current() == main_loop_); |
| 379 DCHECK(proxy_); | 378 DCHECK(proxy_); |
| 380 | 379 |
| 381 if (media::RTCVideoDecoder::IsUrlSupported(url.spec())) { | |
| 382 // Remove the default decoder | |
| 383 scoped_refptr<media::VideoDecoder> old_videodecoder; | |
| 384 filter_collection_->SelectVideoDecoder(&old_videodecoder); | |
| 385 media::RTCVideoDecoder* rtc_video_decoder = | |
| 386 new media::RTCVideoDecoder( | |
| 387 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), | |
| 388 url.spec()); | |
| 389 filter_collection_->AddVideoDecoder(rtc_video_decoder); | |
| 390 } | |
| 391 | |
| 392 if (chunk_demuxer_factory_.get() && | 380 if (chunk_demuxer_factory_.get() && |
| 393 chunk_demuxer_factory_->IsUrlSupported(url.spec())) { | 381 chunk_demuxer_factory_->IsUrlSupported(url.spec())) { |
| 394 media_data_sink_.reset(chunk_demuxer_factory_->CreateMediaDataSink()); | 382 media_data_sink_.reset(chunk_demuxer_factory_->CreateMediaDataSink()); |
| 395 filter_collection_->SetDemuxerFactory(chunk_demuxer_factory_.release()); | 383 filter_collection_->SetDemuxerFactory(chunk_demuxer_factory_.release()); |
| 396 } | 384 } |
| 397 | 385 |
| 398 // Handle any volume changes that occured before load(). | 386 // Handle any volume changes that occured before load(). |
| 399 setVolume(GetClient()->volume()); | 387 setVolume(GetClient()->volume()); |
| 400 // Get the preload value. | 388 // Get the preload value. |
| 401 setPreload(GetClient()->preload()); | 389 setPreload(GetClient()->preload()); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 } | 939 } |
| 952 } | 940 } |
| 953 | 941 |
| 954 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 942 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
| 955 DCHECK(MessageLoop::current() == main_loop_); | 943 DCHECK(MessageLoop::current() == main_loop_); |
| 956 DCHECK(client_); | 944 DCHECK(client_); |
| 957 return client_; | 945 return client_; |
| 958 } | 946 } |
| 959 | 947 |
| 960 } // namespace webkit_glue | 948 } // namespace webkit_glue |
| OLD | NEW |