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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 media_has_played_(false), | 97 media_has_played_(false), |
98 preload_(AUTO), | 98 preload_(AUTO), |
99 bitrate_(0), | 99 bitrate_(0), |
100 playback_rate_(0.0), | 100 playback_rate_(0.0), |
101 media_log_(media_log), | 101 media_log_(media_log), |
102 host_(host), | 102 host_(host), |
103 downloading_cb_(downloading_cb), | 103 downloading_cb_(downloading_cb), |
104 weak_factory_(this) { | 104 weak_factory_(this) { |
105 DCHECK(host_); | 105 DCHECK(host_); |
106 DCHECK(!downloading_cb_.is_null()); | 106 DCHECK(!downloading_cb_.is_null()); |
| 107 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
107 } | 108 } |
108 | 109 |
109 BufferedDataSource::~BufferedDataSource() {} | 110 BufferedDataSource::~BufferedDataSource() { |
| 111 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 112 } |
110 | 113 |
111 // A factory method to create BufferedResourceLoader using the read parameters. | 114 // A factory method to create BufferedResourceLoader using the read parameters. |
112 // This method can be overridden to inject mock BufferedResourceLoader object | 115 // This method can be overridden to inject mock BufferedResourceLoader object |
113 // for testing purpose. | 116 // for testing purpose. |
114 BufferedResourceLoader* BufferedDataSource::CreateResourceLoader( | 117 BufferedResourceLoader* BufferedDataSource::CreateResourceLoader( |
115 int64 first_byte_position, int64 last_byte_position) { | 118 int64 first_byte_position, int64 last_byte_position) { |
116 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 119 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
117 | 120 |
118 BufferedResourceLoader::DeferStrategy strategy = preload_ == METADATA ? | 121 BufferedResourceLoader::DeferStrategy strategy = preload_ == METADATA ? |
119 BufferedResourceLoader::kReadThenDefer : | 122 BufferedResourceLoader::kReadThenDefer : |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } | 530 } |
528 | 531 |
529 // If media is currently playing or the page indicated preload=auto or the | 532 // 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 | 533 // 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 | 534 // too far ahead of the read head, use threshold strategy to enable/disable |
532 // deferring when the buffer is full/depleted. | 535 // deferring when the buffer is full/depleted. |
533 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); | 536 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); |
534 } | 537 } |
535 | 538 |
536 } // namespace media | 539 } // namespace media |
OLD | NEW |