Chromium Code Reviews| 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 "content/renderer/media/rtc_video_decoder.h" | |
|
scherkus (not reviewing)
2011/06/17 00:31:46
webkit glue can't depend on content
AFAIK you'll
Ronghua
2011/06/24 21:08:51
Done.
| |
| 12 #include "media/base/composite_data_source_factory.h" | 13 #include "media/base/composite_data_source_factory.h" |
| 13 #include "media/base/filter_collection.h" | 14 #include "media/base/filter_collection.h" |
| 14 #include "media/base/limits.h" | 15 #include "media/base/limits.h" |
| 15 #include "media/base/media_format.h" | 16 #include "media/base/media_format.h" |
| 16 #include "media/base/media_switches.h" | 17 #include "media/base/media_switches.h" |
| 17 #include "media/base/pipeline_impl.h" | 18 #include "media/base/pipeline_impl.h" |
| 18 #include "media/base/video_frame.h" | 19 #include "media/base/video_frame.h" |
| 19 #include "media/filters/adaptive_demuxer.h" | 20 #include "media/filters/adaptive_demuxer.h" |
| 20 #include "media/filters/ffmpeg_audio_decoder.h" | 21 #include "media/filters/ffmpeg_audio_decoder.h" |
| 21 #include "media/filters/ffmpeg_demuxer_factory.h" | 22 #include "media/filters/ffmpeg_demuxer_factory.h" |
| 22 #include "media/filters/ffmpeg_video_decoder.h" | 23 #include "media/filters/ffmpeg_video_decoder.h" |
| 23 #include "media/filters/rtc_video_decoder.h" | |
| 24 #include "media/filters/null_audio_renderer.h" | 24 #include "media/filters/null_audio_renderer.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" |
| 29 #include "webkit/glue/media/buffered_data_source.h" | 29 #include "webkit/glue/media/buffered_data_source.h" |
| 30 #include "webkit/glue/media/simple_data_source.h" | 30 #include "webkit/glue/media/simple_data_source.h" |
| 31 #include "webkit/glue/media/video_renderer_impl.h" | 31 #include "webkit/glue/media/video_renderer_impl.h" |
| 32 #include "webkit/glue/media/web_video_renderer.h" | 32 #include "webkit/glue/media/web_video_renderer.h" |
| 33 #include "webkit/glue/webvideoframe_impl.h" | 33 #include "webkit/glue/webvideoframe_impl.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 // event. | 366 // event. |
| 367 if (main_loop_) { | 367 if (main_loop_) { |
| 368 main_loop_->RemoveDestructionObserver(this); | 368 main_loop_->RemoveDestructionObserver(this); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 | 371 |
| 372 void WebMediaPlayerImpl::load(const WebKit::WebURL& url) { | 372 void WebMediaPlayerImpl::load(const WebKit::WebURL& url) { |
| 373 DCHECK(MessageLoop::current() == main_loop_); | 373 DCHECK(MessageLoop::current() == main_loop_); |
| 374 DCHECK(proxy_); | 374 DCHECK(proxy_); |
| 375 | 375 |
| 376 bool raw_video = false; | |
| 376 if (media::RTCVideoDecoder::IsUrlSupported(url.spec())) { | 377 if (media::RTCVideoDecoder::IsUrlSupported(url.spec())) { |
| 377 // Remove the default decoder | 378 // Remove the default decoder |
| 378 scoped_refptr<media::VideoDecoder> old_videodecoder; | 379 scoped_refptr<media::VideoDecoder> old_videodecoder; |
| 379 filter_collection_->SelectVideoDecoder(&old_videodecoder); | 380 filter_collection_->SelectVideoDecoder(&old_videodecoder); |
| 380 media::RTCVideoDecoder* rtc_video_decoder = | 381 media::RTCVideoDecoder* rtc_video_decoder = |
| 381 new media::RTCVideoDecoder( | 382 new media::RTCVideoDecoder( |
| 382 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), | 383 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), |
| 383 url.spec()); | 384 url.spec()); |
| 384 filter_collection_->AddVideoDecoder(rtc_video_decoder); | 385 filter_collection_->AddVideoDecoder(rtc_video_decoder); |
| 386 raw_video = true; | |
| 385 } | 387 } |
| 386 | 388 |
| 387 // Handle any volume changes that occured before load(). | 389 // Handle any volume changes that occured before load(). |
| 388 setVolume(GetClient()->volume()); | 390 setVolume(GetClient()->volume()); |
| 389 // Get the preload value. | 391 // Get the preload value. |
| 390 setPreload(GetClient()->preload()); | 392 setPreload(GetClient()->preload()); |
| 391 | 393 |
| 392 // Initialize the pipeline. | 394 // Initialize the pipeline. |
| 393 SetNetworkState(WebKit::WebMediaPlayer::Loading); | 395 SetNetworkState(WebKit::WebMediaPlayer::Loading); |
| 394 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); | 396 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); |
| 395 pipeline_->Start( | 397 pipeline_->Start( |
| 396 filter_collection_.release(), | 398 filter_collection_.release(), |
| 397 url.spec(), | 399 url.spec(), |
| 398 NewCallback(proxy_.get(), | 400 NewCallback(proxy_.get(), |
| 399 &WebMediaPlayerImpl::Proxy::PipelineInitializationCallback)); | 401 &WebMediaPlayerImpl::Proxy::PipelineInitializationCallback), |
| 402 raw_video); | |
| 400 } | 403 } |
| 401 | 404 |
| 402 void WebMediaPlayerImpl::cancelLoad() { | 405 void WebMediaPlayerImpl::cancelLoad() { |
| 403 DCHECK(MessageLoop::current() == main_loop_); | 406 DCHECK(MessageLoop::current() == main_loop_); |
| 404 } | 407 } |
| 405 | 408 |
| 406 void WebMediaPlayerImpl::play() { | 409 void WebMediaPlayerImpl::play() { |
| 407 DCHECK(MessageLoop::current() == main_loop_); | 410 DCHECK(MessageLoop::current() == main_loop_); |
| 408 | 411 |
| 409 paused_ = false; | 412 paused_ = false; |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 926 } | 929 } |
| 927 } | 930 } |
| 928 | 931 |
| 929 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 932 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
| 930 DCHECK(MessageLoop::current() == main_loop_); | 933 DCHECK(MessageLoop::current() == main_loop_); |
| 931 DCHECK(client_); | 934 DCHECK(client_); |
| 932 return client_; | 935 return client_; |
| 933 } | 936 } |
| 934 | 937 |
| 935 } // namespace webkit_glue | 938 } // namespace webkit_glue |
| OLD | NEW |