| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/media/webmediaplayer_impl.h" | 5 #include "webkit/media/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 // Media streams pipelines can start immediately. | 235 // Media streams pipelines can start immediately. |
| 236 if (BuildMediaStreamCollection(url, media_stream_client_, | 236 if (BuildMediaStreamCollection(url, media_stream_client_, |
| 237 message_loop_factory_.get(), | 237 message_loop_factory_.get(), |
| 238 filter_collection_.get())) { | 238 filter_collection_.get())) { |
| 239 StartPipeline(); | 239 StartPipeline(); |
| 240 return; | 240 return; |
| 241 } | 241 } |
| 242 | 242 |
| 243 // Media source pipelines can start immediately. | 243 // Media source pipelines can start immediately. |
| 244 scoped_refptr<media::FFmpegVideoDecoder> video_decoder; | |
| 245 if (BuildMediaSourceCollection(url, GetClient()->sourceURL(), proxy_, | 244 if (BuildMediaSourceCollection(url, GetClient()->sourceURL(), proxy_, |
| 246 message_loop_factory_.get(), | 245 message_loop_factory_.get(), |
| 247 filter_collection_.get(), | 246 filter_collection_.get(), |
| 248 &decryptor_, | 247 &decryptor_)) { |
| 249 &video_decoder)) { | |
| 250 proxy_->set_video_decoder(video_decoder); | |
| 251 StartPipeline(); | 248 StartPipeline(); |
| 252 return; | 249 return; |
| 253 } | 250 } |
| 254 | 251 |
| 255 // Otherwise it's a regular request which requires resolving the URL first. | 252 // Otherwise it's a regular request which requires resolving the URL first. |
| 256 proxy_->set_data_source( | 253 proxy_->set_data_source( |
| 257 new BufferedDataSource(main_loop_, frame_, media_log_, | 254 new BufferedDataSource(main_loop_, frame_, media_log_, |
| 258 base::Bind(&WebMediaPlayerImpl::NotifyDownloading, | 255 base::Bind(&WebMediaPlayerImpl::NotifyDownloading, |
| 259 base::Unretained(this)))); | 256 base::Unretained(this)))); |
| 260 proxy_->data_source()->Initialize( | 257 proxy_->data_source()->Initialize( |
| 261 url, static_cast<BufferedResourceLoader::CORSMode>(cors_mode), | 258 url, static_cast<BufferedResourceLoader::CORSMode>(cors_mode), |
| 262 base::Bind( | 259 base::Bind( |
| 263 &WebMediaPlayerImpl::DataSourceInitialized, | 260 &WebMediaPlayerImpl::DataSourceInitialized, |
| 264 base::Unretained(this), gurl)); | 261 base::Unretained(this), gurl)); |
| 265 | 262 |
| 266 is_local_source_ = !gurl.SchemeIs("http") && !gurl.SchemeIs("https"); | 263 is_local_source_ = !gurl.SchemeIs("http") && !gurl.SchemeIs("https"); |
| 267 | 264 |
| 268 BuildDefaultCollection(proxy_->data_source(), | 265 BuildDefaultCollection(proxy_->data_source(), |
| 269 message_loop_factory_.get(), | 266 message_loop_factory_.get(), |
| 270 filter_collection_.get(), | 267 filter_collection_.get(), |
| 271 &decryptor_, | 268 &decryptor_); |
| 272 &video_decoder); | |
| 273 proxy_->set_video_decoder(video_decoder); | |
| 274 } | 269 } |
| 275 | 270 |
| 276 void WebMediaPlayerImpl::cancelLoad() { | 271 void WebMediaPlayerImpl::cancelLoad() { |
| 277 DCHECK_EQ(main_loop_, MessageLoop::current()); | 272 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 278 } | 273 } |
| 279 | 274 |
| 280 void WebMediaPlayerImpl::play() { | 275 void WebMediaPlayerImpl::play() { |
| 281 DCHECK_EQ(main_loop_, MessageLoop::current()); | 276 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 282 | 277 |
| 283 paused_ = false; | 278 paused_ = false; |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 return audio_source_provider_; | 1059 return audio_source_provider_; |
| 1065 } | 1060 } |
| 1066 | 1061 |
| 1067 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1062 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 1068 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1063 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 1069 incremented_externally_allocated_memory_ = true; | 1064 incremented_externally_allocated_memory_ = true; |
| 1070 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1065 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 1071 } | 1066 } |
| 1072 | 1067 |
| 1073 } // namespace webkit_media | 1068 } // namespace webkit_media |
| OLD | NEW |