Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: media/blink/multibuffer.h

Issue 1971373002: Fix progress reporting for multibuffers to report progress for every byte we receive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: documentation added Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/blink/multibuffer.cc » ('j') | media/blink/multibuffer_reader.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_MULTIBUFFER_H_ 5 #ifndef MEDIA_BLINK_MULTIBUFFER_H_
6 #define MEDIA_BLINK_MULTIBUFFER_H_ 6 #define MEDIA_BLINK_MULTIBUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 virtual ~DataProvider() {} 107 virtual ~DataProvider() {}
108 108
109 // Returns the block number that is to be returned 109 // Returns the block number that is to be returned
110 // by the next Read() call. 110 // by the next Read() call.
111 virtual MultiBufferBlockId Tell() const = 0; 111 virtual MultiBufferBlockId Tell() const = 0;
112 112
113 // Returns true if one (or more) blocks are 113 // Returns true if one (or more) blocks are
114 // availble to read. 114 // availble to read.
115 virtual bool Available() const = 0; 115 virtual bool Available() const = 0;
116 116
117 // Returns how many bytes are available, note that Available() may still
118 // return false even if AvailableBytes() returns true.
liberato (no reviews please) 2016/05/13 17:45:54 s/true./greater than zero, if less than a full blo
hubbe 2016/05/13 17:51:36 Done.
119 virtual int64_t AvailableBytes() const = 0;
120
117 // Returns the next block. Only valid if Available() 121 // Returns the next block. Only valid if Available()
118 // returns true. Last block might be of a smaller size 122 // returns true. Last block might be of a smaller size
119 // and after the last block we will get an end-of-stream 123 // and after the last block we will get an end-of-stream
120 // DataBuffer. 124 // DataBuffer.
121 virtual scoped_refptr<DataBuffer> Read() = 0; 125 virtual scoped_refptr<DataBuffer> Read() = 0;
122 126
123 // Ask the data provider to stop giving us data. 127 // Ask the data provider to stop giving us data.
124 // It's ok if the effect is not immediate. 128 // It's ok if the effect is not immediate.
125 virtual void SetDeferred(bool deferred) = 0; 129 virtual void SetDeferred(bool deferred) = 0;
126 }; 130 };
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Unpin block 4 & 5: PinRange(4, 6, -1); 246 // Unpin block 4 & 5: PinRange(4, 6, -1);
243 void PinRange(const BlockId& from, const BlockId& to, int32_t how_much); 247 void PinRange(const BlockId& from, const BlockId& to, int32_t how_much);
244 248
245 // Calls PinRange for each range in |ranges|, convenience 249 // Calls PinRange for each range in |ranges|, convenience
246 // function for applying multiple changes to the pinned ranges. 250 // function for applying multiple changes to the pinned ranges.
247 void PinRanges(const IntervalMap<BlockId, int32_t>& ranges); 251 void PinRanges(const IntervalMap<BlockId, int32_t>& ranges);
248 252
249 // Increment max cache size by |size| (counted in blocks). 253 // Increment max cache size by |size| (counted in blocks).
250 void IncrementMaxSize(int32_t size); 254 void IncrementMaxSize(int32_t size);
251 255
256 // Returns how many bytes have been received by the data providers at position
257 // |block|, which have not yet been submitted to the multibuffer cache.
258 // The returned number should be less than the size of one block.
259 int64_t UncommittedBytesAt(const BlockId& block);
260
252 // Caller takes ownership of 'provider', cache will 261 // Caller takes ownership of 'provider', cache will
253 // not call it anymore. 262 // not call it anymore.
254 std::unique_ptr<DataProvider> RemoveProvider(DataProvider* provider); 263 std::unique_ptr<DataProvider> RemoveProvider(DataProvider* provider);
255 264
256 // Add a writer to this cache. Cache takes ownership, and may 265 // Add a writer to this cache. Cache takes ownership, and may
257 // destroy |provider| later. (Not during this call.) 266 // destroy |provider| later. (Not during this call.)
258 void AddProvider(std::unique_ptr<DataProvider> provider); 267 void AddProvider(std::unique_ptr<DataProvider> provider);
259 268
260 // Transfer all data from |other| to this. 269 // Transfer all data from |other| to this.
261 void MergeFrom(MultiBuffer* other); 270 void MergeFrom(MultiBuffer* other);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // and 0 for all blocks that are not. Used to quickly figure out 347 // and 0 for all blocks that are not. Used to quickly figure out
339 // ranges of available/unavailable blocks without iterating. 348 // ranges of available/unavailable blocks without iterating.
340 IntervalMap<BlockId, int32_t> present_; 349 IntervalMap<BlockId, int32_t> present_;
341 350
342 DISALLOW_COPY_AND_ASSIGN(MultiBuffer); 351 DISALLOW_COPY_AND_ASSIGN(MultiBuffer);
343 }; 352 };
344 353
345 } // namespace media 354 } // namespace media
346 355
347 #endif // MEDIA_BLINK_MULTIBUFFER_H_ 356 #endif // MEDIA_BLINK_MULTIBUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | media/blink/multibuffer.cc » ('j') | media/blink/multibuffer_reader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698