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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 client_(client), | 124 client_(client), |
125 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)), | 125 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)), |
126 delegate_(delegate), | 126 delegate_(delegate), |
127 media_stream_client_(media_stream_client), | 127 media_stream_client_(media_stream_client), |
128 media_log_(media_log), | 128 media_log_(media_log), |
129 accelerated_compositing_reported_(false), | 129 accelerated_compositing_reported_(false), |
130 incremented_externally_allocated_memory_(false), | 130 incremented_externally_allocated_memory_(false), |
131 audio_source_provider_(audio_source_provider), | 131 audio_source_provider_(audio_source_provider), |
132 audio_renderer_sink_(audio_renderer_sink), | 132 audio_renderer_sink_(audio_renderer_sink), |
133 is_local_source_(false), | 133 is_local_source_(false), |
| 134 supports_save_(true), |
134 decryptor_(proxy_.get(), client, frame) { | 135 decryptor_(proxy_.get(), client, frame) { |
135 media_log_->AddEvent( | 136 media_log_->AddEvent( |
136 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); | 137 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); |
137 | 138 |
138 MessageLoop* pipeline_message_loop = | 139 MessageLoop* pipeline_message_loop = |
139 message_loop_factory_->GetMessageLoop("PipelineThread"); | 140 message_loop_factory_->GetMessageLoop("PipelineThread"); |
140 pipeline_ = new media::Pipeline(pipeline_message_loop, media_log_); | 141 pipeline_ = new media::Pipeline(pipeline_message_loop, media_log_); |
141 | 142 |
142 // Let V8 know we started new thread if we did not did it yet. | 143 // Let V8 know we started new thread if we did not did it yet. |
143 // Made separate task to avoid deletion of player currently being created. | 144 // Made separate task to avoid deletion of player currently being created. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 setPreload(GetClient()->preload()); | 229 setPreload(GetClient()->preload()); |
229 | 230 |
230 SetNetworkState(WebMediaPlayer::NetworkStateLoading); | 231 SetNetworkState(WebMediaPlayer::NetworkStateLoading); |
231 SetReadyState(WebMediaPlayer::ReadyStateHaveNothing); | 232 SetReadyState(WebMediaPlayer::ReadyStateHaveNothing); |
232 media_log_->AddEvent(media_log_->CreateLoadEvent(url.spec())); | 233 media_log_->AddEvent(media_log_->CreateLoadEvent(url.spec())); |
233 | 234 |
234 // Media streams pipelines can start immediately. | 235 // Media streams pipelines can start immediately. |
235 if (BuildMediaStreamCollection(url, media_stream_client_, | 236 if (BuildMediaStreamCollection(url, media_stream_client_, |
236 message_loop_factory_.get(), | 237 message_loop_factory_.get(), |
237 filter_collection_.get())) { | 238 filter_collection_.get())) { |
| 239 supports_save_ = false; |
238 StartPipeline(); | 240 StartPipeline(); |
239 return; | 241 return; |
240 } | 242 } |
241 | 243 |
242 // Media source pipelines can start immediately. | 244 // Media source pipelines can start immediately. |
243 if (BuildMediaSourceCollection(url, GetClient()->sourceURL(), proxy_, | 245 if (BuildMediaSourceCollection(url, GetClient()->sourceURL(), proxy_, |
244 message_loop_factory_.get(), | 246 message_loop_factory_.get(), |
245 filter_collection_.get(), | 247 filter_collection_.get(), |
246 &decryptor_)) { | 248 &decryptor_)) { |
| 249 supports_save_ = false; |
247 StartPipeline(); | 250 StartPipeline(); |
248 return; | 251 return; |
249 } | 252 } |
250 | 253 |
251 // Otherwise it's a regular request which requires resolving the URL first. | 254 // Otherwise it's a regular request which requires resolving the URL first. |
252 proxy_->set_data_source( | 255 proxy_->set_data_source( |
253 new BufferedDataSource(main_loop_, frame_, media_log_, | 256 new BufferedDataSource(main_loop_, frame_, media_log_, |
254 base::Bind(&WebMediaPlayerImpl::NotifyDownloading, | 257 base::Bind(&WebMediaPlayerImpl::NotifyDownloading, |
255 base::Unretained(this)))); | 258 base::Unretained(this)))); |
256 proxy_->data_source()->Initialize( | 259 proxy_->data_source()->Initialize( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 delegate_->DidPause(this); | 299 delegate_->DidPause(this); |
297 } | 300 } |
298 | 301 |
299 bool WebMediaPlayerImpl::supportsFullscreen() const { | 302 bool WebMediaPlayerImpl::supportsFullscreen() const { |
300 DCHECK_EQ(main_loop_, MessageLoop::current()); | 303 DCHECK_EQ(main_loop_, MessageLoop::current()); |
301 return true; | 304 return true; |
302 } | 305 } |
303 | 306 |
304 bool WebMediaPlayerImpl::supportsSave() const { | 307 bool WebMediaPlayerImpl::supportsSave() const { |
305 DCHECK_EQ(main_loop_, MessageLoop::current()); | 308 DCHECK_EQ(main_loop_, MessageLoop::current()); |
306 return true; | 309 return supports_save_; |
307 } | 310 } |
308 | 311 |
309 void WebMediaPlayerImpl::seek(float seconds) { | 312 void WebMediaPlayerImpl::seek(float seconds) { |
310 DCHECK_EQ(main_loop_, MessageLoop::current()); | 313 DCHECK_EQ(main_loop_, MessageLoop::current()); |
311 | 314 |
312 if (seeking_) { | 315 if (seeking_) { |
313 pending_seek_ = true; | 316 pending_seek_ = true; |
314 pending_seek_seconds_ = seconds; | 317 pending_seek_seconds_ = seconds; |
315 proxy_->DemuxerCancelPendingSeek(); | 318 proxy_->DemuxerCancelPendingSeek(); |
316 return; | 319 return; |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 return audio_source_provider_; | 1029 return audio_source_provider_; |
1027 } | 1030 } |
1028 | 1031 |
1029 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1032 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
1030 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1033 DCHECK_EQ(main_loop_, MessageLoop::current()); |
1031 incremented_externally_allocated_memory_ = true; | 1034 incremented_externally_allocated_memory_ = true; |
1032 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1035 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
1033 } | 1036 } |
1034 | 1037 |
1035 } // namespace webkit_media | 1038 } // namespace webkit_media |
OLD | NEW |