| 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 #ifndef WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 5 #ifndef WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| 6 #define WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 6 #define WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 scoped_ptr<BufferedResourceLoader> loader_; | 158 scoped_ptr<BufferedResourceLoader> loader_; |
| 159 | 159 |
| 160 // True if |loader| is downloading data. | 160 // True if |loader| is downloading data. |
| 161 bool is_downloading_data_; | 161 bool is_downloading_data_; |
| 162 | 162 |
| 163 // Callback method from the pipeline for initialization. | 163 // Callback method from the pipeline for initialization. |
| 164 media::PipelineStatusCB initialize_cb_; | 164 media::PipelineStatusCB initialize_cb_; |
| 165 | 165 |
| 166 // Read parameters received from the Read() method call. | 166 // Read parameters received from the Read() method call. |
| 167 media::DataSource::ReadCB read_cb_; | 167 media::DataSource::ReadCB read_cb_; |
| 168 int64 read_position_; | |
| 169 int read_size_; | 168 int read_size_; |
| 170 uint8* read_buffer_; | 169 uint8* read_buffer_; |
| 170 // Retained between reads to make sense of buffering information. |
| 171 int64 last_read_start_; |
| 171 | 172 |
| 172 // This buffer is intermediate, we use it for BufferedResourceLoader to write | 173 // This buffer is intermediate, we use it for BufferedResourceLoader to write |
| 173 // to. And when read in BufferedResourceLoader is done, we copy data from | 174 // to. And when read in BufferedResourceLoader is done, we copy data from |
| 174 // this buffer to |read_buffer_|. The reason for an additional copy is that | 175 // this buffer to |read_buffer_|. The reason for an additional copy is that |
| 175 // we don't own |read_buffer_|. But since the read operation is asynchronous, | 176 // we don't own |read_buffer_|. But since the read operation is asynchronous, |
| 176 // |read_buffer| can be destroyed at any time, so we only copy into | 177 // |read_buffer| can be destroyed at any time, so we only copy into |
| 177 // |read_buffer| in the final step when it is safe. | 178 // |read_buffer| in the final step when it is safe. |
| 178 // Memory is allocated for this member during initialization of this object | 179 // Memory is allocated for this member during initialization of this object |
| 179 // because we want buffer to be passed into BufferedResourceLoader to be | 180 // because we want buffer to be passed into BufferedResourceLoader to be |
| 180 // always non-null. And by initializing this member with a default size we can | 181 // always non-null. And by initializing this member with a default size we can |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 float playback_rate_; | 216 float playback_rate_; |
| 216 | 217 |
| 217 scoped_refptr<media::MediaLog> media_log_; | 218 scoped_refptr<media::MediaLog> media_log_; |
| 218 | 219 |
| 219 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 220 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 220 }; | 221 }; |
| 221 | 222 |
| 222 } // namespace webkit_media | 223 } // namespace webkit_media |
| 223 | 224 |
| 224 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 225 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |