OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_ | 5 #ifndef MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_ |
6 #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_ | 6 #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_ |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "media/blink/buffered_data_source.h" | 9 #include "media/blink/buffered_data_source.h" |
10 #include "media/blink/media_blink_export.h" | 10 #include "media/blink/media_blink_export.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 // Provides an implementation of BufferedDataSourceHost that translates the | 14 // Provides an implementation of BufferedDataSourceHost that translates the |
15 // buffered byte ranges into estimated time ranges. | 15 // buffered byte ranges into estimated time ranges. |
16 class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl | 16 class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl |
17 : public BufferedDataSourceHost { | 17 : public BufferedDataSourceHost { |
18 public: | 18 public: |
19 BufferedDataSourceHostImpl(); | 19 BufferedDataSourceHostImpl(); |
20 ~BufferedDataSourceHostImpl() override; | 20 ~BufferedDataSourceHostImpl() override; |
21 | 21 |
22 // BufferedDataSourceHost implementation. | 22 // BufferedDataSourceHost implementation. |
23 void SetTotalBytes(int64 total_bytes) override; | 23 void SetTotalBytes(int64_t total_bytes) override; |
24 void AddBufferedByteRange(int64 start, int64 end) override; | 24 void AddBufferedByteRange(int64_t start, int64_t end) override; |
25 | 25 |
26 // Translate the byte ranges to time ranges and append them to the list. | 26 // Translate the byte ranges to time ranges and append them to the list. |
27 // TODO(sandersd): This is a confusing name, find something better. | 27 // TODO(sandersd): This is a confusing name, find something better. |
28 void AddBufferedTimeRanges( | 28 void AddBufferedTimeRanges( |
29 Ranges<base::TimeDelta>* buffered_time_ranges, | 29 Ranges<base::TimeDelta>* buffered_time_ranges, |
30 base::TimeDelta media_duration) const; | 30 base::TimeDelta media_duration) const; |
31 | 31 |
32 bool DidLoadingProgress(); | 32 bool DidLoadingProgress(); |
33 | 33 |
34 private: | 34 private: |
35 // Total size of the data source. | 35 // Total size of the data source. |
36 int64 total_bytes_; | 36 int64_t total_bytes_; |
37 | 37 |
38 // List of buffered byte ranges for estimating buffered time. | 38 // List of buffered byte ranges for estimating buffered time. |
39 // The InterValMap value is 1 for bytes that are buffered, 0 otherwise. | 39 // The InterValMap value is 1 for bytes that are buffered, 0 otherwise. |
40 IntervalMap<int64, int> buffered_byte_ranges_; | 40 IntervalMap<int64_t, int> buffered_byte_ranges_; |
41 | 41 |
42 // True when AddBufferedByteRange() has been called more recently than | 42 // True when AddBufferedByteRange() has been called more recently than |
43 // DidLoadingProgress(). | 43 // DidLoadingProgress(). |
44 bool did_loading_progress_; | 44 bool did_loading_progress_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(BufferedDataSourceHostImpl); | 46 DISALLOW_COPY_AND_ASSIGN(BufferedDataSourceHostImpl); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace media | 49 } // namespace media |
50 | 50 |
51 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_ | 51 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_ |
OLD | NEW |