OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 MEDIA_BASE_DOWNLOAD_RATE_MONITOR_H_ | 5 #ifndef MEDIA_BASE_DOWNLOAD_RATE_MONITOR_H_ |
6 #define MEDIA_BASE_DOWNLOAD_RATE_MONITOR_H_ | 6 #define MEDIA_BASE_DOWNLOAD_RATE_MONITOR_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // Calls to the method are ignored if monitor has not been started or is | 33 // Calls to the method are ignored if monitor has not been started or is |
34 // stopped. | 34 // stopped. |
35 void SetBufferedBytes(int64 buffered_bytes, const base::Time& timestamp); | 35 void SetBufferedBytes(int64 buffered_bytes, const base::Time& timestamp); |
36 | 36 |
37 // Notifies the monitor when the media file has paused or continued | 37 // Notifies the monitor when the media file has paused or continued |
38 // downloading data. | 38 // downloading data. |
39 void SetNetworkActivity(bool is_downloading_data); | 39 void SetNetworkActivity(bool is_downloading_data); |
40 | 40 |
41 void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; } | 41 void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; } |
42 | 42 |
43 void set_loaded(bool loaded) { loaded_ = loaded; } | 43 void set_local_source(bool local_source) { local_source_ = local_source; } |
| 44 |
| 45 void set_streaming(bool streaming) { streaming_ = streaming; } |
44 | 46 |
45 // Stop monitoring download rate. This does not discard previously learned | 47 // Stop monitoring download rate. This does not discard previously learned |
46 // information, but it will no longer factor incoming information into its | 48 // information, but it will no longer factor incoming information into its |
47 // canplaythrough estimation. | 49 // canplaythrough estimation. |
48 void Stop(); | 50 void Stop(); |
49 | 51 |
50 // Resets monitor to uninitialized state. | 52 // Resets monitor to uninitialized state. |
51 void Reset(); | 53 void Reset(); |
52 | 54 |
53 private: | 55 private: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 132 |
131 // True if actively downloading bytes, false otherwise. | 133 // True if actively downloading bytes, false otherwise. |
132 bool is_downloading_data_; | 134 bool is_downloading_data_; |
133 | 135 |
134 // Total number of bytes in the media file, 0 if unknown or undefined. | 136 // Total number of bytes in the media file, 0 if unknown or undefined. |
135 int64 total_bytes_; | 137 int64 total_bytes_; |
136 | 138 |
137 // Amount of bytes buffered. | 139 // Amount of bytes buffered. |
138 int64 buffered_bytes_; | 140 int64 buffered_bytes_; |
139 | 141 |
140 // True if the media file is a fully loaded source, e.g. file:// protocol. | 142 // True if the media file is from a local source, e.g. file:// protocol or a |
141 bool loaded_; | 143 // webcam stream. |
| 144 bool local_source_; |
142 | 145 |
143 // Bitrate of the media file, 0 if unknown. | 146 // Bitrate of the media file, 0 if unknown. |
144 int bitrate_; | 147 int bitrate_; |
145 | 148 |
146 // True if the monitor has not yet started or has been stopped, false | 149 // True if the monitor has not yet started or has been stopped, false |
147 // otherwise. | 150 // otherwise. |
148 bool stopped_; | 151 bool stopped_; |
149 | 152 |
| 153 // True if the data source is a streaming source, false otherwise. |
| 154 bool streaming_; |
| 155 |
150 DISALLOW_COPY_AND_ASSIGN(DownloadRateMonitor); | 156 DISALLOW_COPY_AND_ASSIGN(DownloadRateMonitor); |
151 }; | 157 }; |
152 | 158 |
153 } // namespace media | 159 } // namespace media |
154 | 160 |
155 #endif // MEDIA_BASE_DOWNLOAD_RATE_MONITOR_H_ | 161 #endif // MEDIA_BASE_DOWNLOAD_RATE_MONITOR_H_ |
OLD | NEW |