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

Side by Side Diff: media/filters/source_buffer_range.h

Issue 1018373003: Improving WebM video duration estimation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing try failure, remove unused variable for some builds. Created 5 years, 8 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 | « media/base/stream_parser_buffer.cc ('k') | media/filters/source_buffer_range.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_FILTERS_SOURCE_BUFFER_RANGE_H_ 5 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_
6 #define MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ 6 #define MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // Adds all buffers which overlap [start, end) to the end of |buffers|. If 199 // Adds all buffers which overlap [start, end) to the end of |buffers|. If
200 // no buffers exist in the range returns false, true otherwise. 200 // no buffers exist in the range returns false, true otherwise.
201 bool GetBuffersInRange(DecodeTimestamp start, DecodeTimestamp end, 201 bool GetBuffersInRange(DecodeTimestamp start, DecodeTimestamp end,
202 BufferQueue* buffers); 202 BufferQueue* buffers);
203 203
204 int size_in_bytes() const { return size_in_bytes_; } 204 int size_in_bytes() const { return size_in_bytes_; }
205 205
206 private: 206 private:
207 typedef std::map<DecodeTimestamp, int> KeyframeMap; 207 typedef std::map<DecodeTimestamp, int> KeyframeMap;
208 208
209 // Called during AppendBuffersToEnd to adjust estimated duration at the
210 // end of the last append to match the delta in timestamps between
211 // the last append and the upcoming append. This is a workaround for
212 // WebM media where a duration is not always specified.
213 void AdjustEstimatedDurationForNewAppend(const BufferQueue& new_buffers);
214
209 // Seeks the range to the next keyframe after |timestamp|. If 215 // Seeks the range to the next keyframe after |timestamp|. If
210 // |skip_given_timestamp| is true, the seek will go to a keyframe with a 216 // |skip_given_timestamp| is true, the seek will go to a keyframe with a
211 // timestamp strictly greater than |timestamp|. 217 // timestamp strictly greater than |timestamp|.
212 void SeekAhead(DecodeTimestamp timestamp, bool skip_given_timestamp); 218 void SeekAhead(DecodeTimestamp timestamp, bool skip_given_timestamp);
213 219
214 // Returns an iterator in |buffers_| pointing to the buffer at |timestamp|. 220 // Returns an iterator in |buffers_| pointing to the buffer at |timestamp|.
215 // If |skip_given_timestamp| is true, this returns the first buffer with 221 // If |skip_given_timestamp| is true, this returns the first buffer with
216 // timestamp greater than |timestamp|. 222 // timestamp greater than |timestamp|.
217 BufferQueue::iterator GetBufferItrAt( 223 BufferQueue::iterator GetBufferItrAt(
218 DecodeTimestamp timestamp, bool skip_given_timestamp); 224 DecodeTimestamp timestamp, bool skip_given_timestamp);
219 225
220 // Returns an iterator in |keyframe_map_| pointing to the next keyframe after 226 // Returns an iterator in |keyframe_map_| pointing to the next keyframe after
221 // |timestamp|. If |skip_given_timestamp| is true, this returns the first 227 // |timestamp|. If |skip_given_timestamp| is true, this returns the first
222 // keyframe with a timestamp strictly greater than |timestamp|. 228 // keyframe with a timestamp strictly greater than |timestamp|.
223 KeyframeMap::iterator GetFirstKeyframeAt( 229 KeyframeMap::iterator GetFirstKeyframeAt(
224 DecodeTimestamp timestamp, bool skip_given_timestamp); 230 DecodeTimestamp timestamp, bool skip_given_timestamp);
225 231
226 // Returns an iterator in |keyframe_map_| pointing to the first keyframe 232 // Returns an iterator in |keyframe_map_| pointing to the first keyframe
227 // before or at |timestamp|. 233 // before or at |timestamp|.
228 KeyframeMap::iterator GetFirstKeyframeBefore(DecodeTimestamp timestamp); 234 KeyframeMap::iterator GetFirstKeyframeAtOrBefore(DecodeTimestamp timestamp);
229 235
230 // Helper method to delete buffers in |buffers_| starting at 236 // Helper method to delete buffers in |buffers_| starting at
231 // |starting_point|, an iterator in |buffers_|. 237 // |starting_point|, an iterator in |buffers_|.
232 // Returns true if everything in the range was removed. Returns 238 // Returns true if everything in the range was removed. Returns
233 // false if the range still contains buffers. 239 // false if the range still contains buffers.
234 bool TruncateAt(const BufferQueue::iterator& starting_point, 240 bool TruncateAt(const BufferQueue::iterator& starting_point,
235 BufferQueue* deleted_buffers); 241 BufferQueue* deleted_buffers);
236 242
237 // Frees the buffers in |buffers_| from [|start_point|,|ending_point|) and 243 // Frees the buffers in |buffers_| from [|start_point|,|ending_point|) and
238 // updates the |size_in_bytes_| accordingly. Does not update |keyframe_map_|. 244 // updates the |size_in_bytes_| accordingly. Does not update |keyframe_map_|.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 285
280 // Stores the amount of memory taken up by the data in |buffers_|. 286 // Stores the amount of memory taken up by the data in |buffers_|.
281 int size_in_bytes_; 287 int size_in_bytes_;
282 288
283 DISALLOW_COPY_AND_ASSIGN(SourceBufferRange); 289 DISALLOW_COPY_AND_ASSIGN(SourceBufferRange);
284 }; 290 };
285 291
286 } // namespace media 292 } // namespace media
287 293
288 #endif // MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ 294 #endif // MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_
OLDNEW
« no previous file with comments | « media/base/stream_parser_buffer.cc ('k') | media/filters/source_buffer_range.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698