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..f3bf3f42bcb470cb90eb6964b8294b9a0708c87e 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_; |
@@ -61,6 +76,8 @@ class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl |
// True when AddBufferedByteRange() has been called more recently than |
// DidLoadingProgress(). |
bool did_loading_progress_; |
+ std::deque<std::pair<base::TimeTicks, uint64_t>> download_history_; |
+ base::Closure progress_cb_; |
DISALLOW_COPY_AND_ASSIGN(BufferedDataSourceHostImpl); |
}; |