OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/buffered_data_source.h" | 5 #include "content/renderer/media/buffered_data_source.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 UpdateDeferStrategy(false); | 200 UpdateDeferStrategy(false); |
201 } | 201 } |
202 | 202 |
203 void BufferedDataSource::MediaIsPaused() { | 203 void BufferedDataSource::MediaIsPaused() { |
204 DCHECK(render_loop_->BelongsToCurrentThread()); | 204 DCHECK(render_loop_->BelongsToCurrentThread()); |
205 UpdateDeferStrategy(true); | 205 UpdateDeferStrategy(true); |
206 } | 206 } |
207 | 207 |
208 ///////////////////////////////////////////////////////////////////////////// | 208 ///////////////////////////////////////////////////////////////////////////// |
209 // media::DataSource implementation. | 209 // media::DataSource implementation. |
210 void BufferedDataSource::Stop() { | 210 void BufferedDataSource::Stop(const base::Closure& closure) { |
211 { | 211 { |
212 base::AutoLock auto_lock(lock_); | 212 base::AutoLock auto_lock(lock_); |
213 StopInternal_Locked(); | 213 StopInternal_Locked(); |
214 } | 214 } |
| 215 closure.Run(); |
215 | 216 |
216 render_loop_->PostTask( | 217 render_loop_->PostTask( |
217 FROM_HERE, | 218 FROM_HERE, |
218 base::Bind(&BufferedDataSource::StopLoader, weak_factory_.GetWeakPtr())); | 219 base::Bind(&BufferedDataSource::StopLoader, weak_factory_.GetWeakPtr())); |
219 } | 220 } |
220 | 221 |
221 void BufferedDataSource::SetBitrate(int bitrate) { | 222 void BufferedDataSource::SetBitrate(int bitrate) { |
222 render_loop_->PostTask(FROM_HERE, | 223 render_loop_->PostTask(FROM_HERE, |
223 base::Bind(&BufferedDataSource::SetBitrateTask, | 224 base::Bind(&BufferedDataSource::SetBitrateTask, |
224 weak_factory_.GetWeakPtr(), | 225 weak_factory_.GetWeakPtr(), |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } | 528 } |
528 | 529 |
529 // If media is currently playing or the page indicated preload=auto or the | 530 // If media is currently playing or the page indicated preload=auto or the |
530 // the server does not support the byte range request or we do not want to go | 531 // the server does not support the byte range request or we do not want to go |
531 // too far ahead of the read head, use threshold strategy to enable/disable | 532 // too far ahead of the read head, use threshold strategy to enable/disable |
532 // deferring when the buffer is full/depleted. | 533 // deferring when the buffer is full/depleted. |
533 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); | 534 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); |
534 } | 535 } |
535 | 536 |
536 } // namespace content | 537 } // namespace content |
OLD | NEW |