Chromium Code Reviews| Index: media/blink/buffered_data_source_host_impl.h |
| diff --git a/media/blink/buffered_data_source_host_impl.h b/media/blink/buffered_data_source_host_impl.h |
| index 7dc39ea331a6ab447e0998e6ca19ce10e254acdf..2caa4098fd6148aa02fb66092d7314f462a7d4de 100644 |
| --- a/media/blink/buffered_data_source_host_impl.h |
| +++ b/media/blink/buffered_data_source_host_impl.h |
| @@ -6,7 +6,9 @@ |
| #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_ |
| #include <stdint.h> |
| +#include <deque> |
| +#include "base/callback.h" |
| #include "base/macros.h" |
| #include "base/time/time.h" |
| #include "media/base/ranges.h" |
| @@ -35,7 +37,7 @@ class MEDIA_BLINK_EXPORT BufferedDataSourceHost { |
| class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl |
| : public BufferedDataSourceHost { |
| public: |
| - BufferedDataSourceHostImpl(); |
| + explicit BufferedDataSourceHostImpl(const base::Closure& progress_cb); |
| ~BufferedDataSourceHostImpl() override; |
| // BufferedDataSourceHost implementation. |
| @@ -50,7 +52,20 @@ class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl |
| bool DidLoadingProgress(); |
| + // Returns true if we have enough buffered bytes to play from now |
| + // until the end of media |
| + bool CanPlayThrough(base::TimeDelta current_position, |
| + base::TimeDelta media_duration, |
| + double playback_rate) const; |
| + |
| private: |
| + // Returns number of bytes not yet loaded in the given interval. |
| + int64_t UnloadedBytesInInterval(const Interval<int64_t>& interval) const; |
| + |
| + // Returns an estimate of the download rate. |
| + // Returns 0.0 if an estimate cannot be made. |
| + double DownloadRate() const; |
| + |
| // Total size of the data source. |
| int64_t total_bytes_; |
| @@ -62,6 +77,11 @@ class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl |
| // DidLoadingProgress(). |
| bool did_loading_progress_; |
| + // Contains how much we had downloaded at a given time. |
| + // Pruned to contain roughly the last 10 seconds of data. |
| + std::deque<std::pair<base::TimeTicks, uint64_t>> download_history_; |
|
sandersd (OOO until July 31)
2017/04/25 22:00:57
I'm a bit worried about the size and complexity of
hubbe
2017/04/25 23:47:03
Given that each entry represents at least 1000 byt
DaleCurtis
2017/04/26 00:11:26
What does the size of this look like currently? I
hubbe
2017/04/26 00:24:27
There is a maximum of 1000 entries right now.
|
| + base::Closure progress_cb_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(BufferedDataSourceHostImpl); |
| }; |