| 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 "media/blink/buffered_data_source.h" | 5 #include "media/blink/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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 void BufferedDataSource::Abort() { | 182 void BufferedDataSource::Abort() { |
| 183 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 183 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 184 { | 184 { |
| 185 base::AutoLock auto_lock(lock_); | 185 base::AutoLock auto_lock(lock_); |
| 186 StopInternal_Locked(); | 186 StopInternal_Locked(); |
| 187 } | 187 } |
| 188 StopLoader(); | 188 StopLoader(); |
| 189 frame_ = NULL; | 189 frame_ = NULL; |
| 190 } | 190 } |
| 191 | 191 |
| 192 void BufferedDataSource::MediaPlaybackRateChanged(float playback_rate) { | 192 void BufferedDataSource::MediaPlaybackRateChanged(double playback_rate) { |
| 193 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 193 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 194 DCHECK(loader_.get()); | 194 DCHECK(loader_.get()); |
| 195 | 195 |
| 196 if (playback_rate < 0.0f) | 196 if (playback_rate < 0.0) |
| 197 return; | 197 return; |
| 198 | 198 |
| 199 playback_rate_ = playback_rate; | 199 playback_rate_ = playback_rate; |
| 200 loader_->SetPlaybackRate(playback_rate); | 200 loader_->SetPlaybackRate(playback_rate); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void BufferedDataSource::MediaIsPlaying() { | 203 void BufferedDataSource::MediaIsPlaying() { |
| 204 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 204 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 205 media_has_played_ = true; | 205 media_has_played_ = true; |
| 206 UpdateDeferStrategy(false); | 206 UpdateDeferStrategy(false); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 } | 551 } |
| 552 | 552 |
| 553 // If media is currently playing or the page indicated preload=auto or the | 553 // If media is currently playing or the page indicated preload=auto or the |
| 554 // the server does not support the byte range request or we do not want to go | 554 // the server does not support the byte range request or we do not want to go |
| 555 // too far ahead of the read head, use threshold strategy to enable/disable | 555 // too far ahead of the read head, use threshold strategy to enable/disable |
| 556 // deferring when the buffer is full/depleted. | 556 // deferring when the buffer is full/depleted. |
| 557 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); | 557 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); |
| 558 } | 558 } |
| 559 | 559 |
| 560 } // namespace media | 560 } // namespace media |
| OLD | NEW |