| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "media/blink/buffered_data_source.h" | 12 #include "media/base/ranges.h" |
| 13 #include "media/blink/interval_map.h" |
| 13 #include "media/blink/media_blink_export.h" | 14 #include "media/blink/media_blink_export.h" |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| 16 | 17 |
| 18 // Interface for testing purposes. |
| 19 class MEDIA_BLINK_EXPORT BufferedDataSourceHost { |
| 20 public: |
| 21 // Notify the host of the total size of the media file. |
| 22 virtual void SetTotalBytes(int64_t total_bytes) = 0; |
| 23 |
| 24 // Notify the host that byte range [start,end] has been buffered. |
| 25 // TODO(fischman): remove this method when demuxing is push-based instead of |
| 26 // pull-based. http://crbug.com/131444 |
| 27 virtual void AddBufferedByteRange(int64_t start, int64_t end) = 0; |
| 28 |
| 29 protected: |
| 30 virtual ~BufferedDataSourceHost() {} |
| 31 }; |
| 32 |
| 17 // Provides an implementation of BufferedDataSourceHost that translates the | 33 // Provides an implementation of BufferedDataSourceHost that translates the |
| 18 // buffered byte ranges into estimated time ranges. | 34 // buffered byte ranges into estimated time ranges. |
| 19 class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl | 35 class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl |
| 20 : public BufferedDataSourceHost { | 36 : public BufferedDataSourceHost { |
| 21 public: | 37 public: |
| 22 BufferedDataSourceHostImpl(); | 38 BufferedDataSourceHostImpl(); |
| 23 ~BufferedDataSourceHostImpl() override; | 39 ~BufferedDataSourceHostImpl() override; |
| 24 | 40 |
| 25 // BufferedDataSourceHost implementation. | 41 // BufferedDataSourceHost implementation. |
| 26 void SetTotalBytes(int64_t total_bytes) override; | 42 void SetTotalBytes(int64_t total_bytes) override; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 45 // True when AddBufferedByteRange() has been called more recently than | 61 // True when AddBufferedByteRange() has been called more recently than |
| 46 // DidLoadingProgress(). | 62 // DidLoadingProgress(). |
| 47 bool did_loading_progress_; | 63 bool did_loading_progress_; |
| 48 | 64 |
| 49 DISALLOW_COPY_AND_ASSIGN(BufferedDataSourceHostImpl); | 65 DISALLOW_COPY_AND_ASSIGN(BufferedDataSourceHostImpl); |
| 50 }; | 66 }; |
| 51 | 67 |
| 52 } // namespace media | 68 } // namespace media |
| 53 | 69 |
| 54 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_ | 70 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_ |
| OLD | NEW |