| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 if (video_renderer_) | 219 if (video_renderer_) |
| 220 video_renderer_->PutCurrentFrame(frame); | 220 video_renderer_->PutCurrentFrame(frame); |
| 221 } | 221 } |
| 222 | 222 |
| 223 ///////////////////////////////////////////////////////////////////////////// | 223 ///////////////////////////////////////////////////////////////////////////// |
| 224 // WebMediaPlayerImpl implementation | 224 // WebMediaPlayerImpl implementation |
| 225 | 225 |
| 226 WebMediaPlayerImpl::WebMediaPlayerImpl( | 226 WebMediaPlayerImpl::WebMediaPlayerImpl( |
| 227 WebKit::WebMediaPlayerClient* client, | 227 WebKit::WebMediaPlayerClient* client, |
| 228 media::MediaFilterCollection* collection, | 228 media::MediaFilterCollection* collection, |
| 229 MediaResourceLoaderBridgeFactory* bridge_factory_simple, | 229 WebKit::WebFrame* frame, |
| 230 MediaResourceLoaderBridgeFactory* bridge_factory_buffered, | |
| 231 bool use_simple_data_source, | 230 bool use_simple_data_source, |
| 232 scoped_refptr<WebVideoRenderer> web_video_renderer) | 231 scoped_refptr<WebVideoRenderer> web_video_renderer) |
| 233 : network_state_(WebKit::WebMediaPlayer::Empty), | 232 : network_state_(WebKit::WebMediaPlayer::Empty), |
| 234 ready_state_(WebKit::WebMediaPlayer::HaveNothing), | 233 ready_state_(WebKit::WebMediaPlayer::HaveNothing), |
| 235 main_loop_(NULL), | 234 main_loop_(NULL), |
| 236 filter_collection_(collection), | 235 filter_collection_(collection), |
| 237 pipeline_thread_("PipelineThread"), | 236 pipeline_thread_("PipelineThread"), |
| 238 paused_(true), | 237 paused_(true), |
| 239 playback_rate_(0.0f), | 238 playback_rate_(0.0f), |
| 240 client_(client), | 239 client_(client), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 263 pipeline_->Init( | 262 pipeline_->Init( |
| 264 NewCallback(proxy_.get(), | 263 NewCallback(proxy_.get(), |
| 265 &WebMediaPlayerImpl::Proxy::PipelineEndedCallback), | 264 &WebMediaPlayerImpl::Proxy::PipelineEndedCallback), |
| 266 NewCallback(proxy_.get(), | 265 NewCallback(proxy_.get(), |
| 267 &WebMediaPlayerImpl::Proxy::PipelineErrorCallback), | 266 &WebMediaPlayerImpl::Proxy::PipelineErrorCallback), |
| 268 NewCallback(proxy_.get(), | 267 NewCallback(proxy_.get(), |
| 269 &WebMediaPlayerImpl::Proxy::NetworkEventCallback)); | 268 &WebMediaPlayerImpl::Proxy::NetworkEventCallback)); |
| 270 | 269 |
| 271 // A simple data source that keeps all data in memory. | 270 // A simple data source that keeps all data in memory. |
| 272 scoped_refptr<SimpleDataSource> simple_data_source( | 271 scoped_refptr<SimpleDataSource> simple_data_source( |
| 273 new SimpleDataSource(MessageLoop::current(), bridge_factory_simple)); | 272 new SimpleDataSource(MessageLoop::current(), frame)); |
| 274 | 273 |
| 275 // A sophisticated data source that does memory caching. | 274 // A sophisticated data source that does memory caching. |
| 276 scoped_refptr<BufferedDataSource> buffered_data_source( | 275 scoped_refptr<BufferedDataSource> buffered_data_source( |
| 277 new BufferedDataSource(MessageLoop::current(), bridge_factory_buffered)); | 276 new BufferedDataSource(MessageLoop::current(), frame)); |
| 278 proxy_->SetDataSource(buffered_data_source); | 277 proxy_->SetDataSource(buffered_data_source); |
| 279 | 278 |
| 280 if (use_simple_data_source) { | 279 if (use_simple_data_source) { |
| 281 filter_collection_->AddDataSource(simple_data_source); | 280 filter_collection_->AddDataSource(simple_data_source); |
| 282 filter_collection_->AddDataSource(buffered_data_source); | 281 filter_collection_->AddDataSource(buffered_data_source); |
| 283 } else { | 282 } else { |
| 284 filter_collection_->AddDataSource(buffered_data_source); | 283 filter_collection_->AddDataSource(buffered_data_source); |
| 285 filter_collection_->AddDataSource(simple_data_source); | 284 filter_collection_->AddDataSource(simple_data_source); |
| 286 } | 285 } |
| 287 | 286 |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 pipeline_stopped_.Signal(); | 792 pipeline_stopped_.Signal(); |
| 794 } | 793 } |
| 795 | 794 |
| 796 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 795 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
| 797 DCHECK(MessageLoop::current() == main_loop_); | 796 DCHECK(MessageLoop::current() == main_loop_); |
| 798 DCHECK(client_); | 797 DCHECK(client_); |
| 799 return client_; | 798 return client_; |
| 800 } | 799 } |
| 801 | 800 |
| 802 } // namespace webkit_glue | 801 } // namespace webkit_glue |
| OLD | NEW |