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

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

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // SourceBufferStream is a data structure that stores media Buffers in ranges. 5 // SourceBufferStream is a data structure that stores media Buffers in ranges.
6 // Buffers can be appended out of presentation order. Buffers are retrieved by 6 // Buffers can be appended out of presentation order. Buffers are retrieved by
7 // seeking to the desired start point and calling GetNextBuffer(). Buffers are 7 // seeking to the desired start point and calling GetNextBuffer(). Buffers are
8 // returned in sequential presentation order. 8 // returned in sequential presentation order.
9 9
10 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ 10 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // next to it, and merges them if so. 204 // next to it, and merges them if so.
205 void MergeWithAdjacentRangeIfNecessary( 205 void MergeWithAdjacentRangeIfNecessary(
206 const RangeList::iterator& range_with_new_buffers_itr); 206 const RangeList::iterator& range_with_new_buffers_itr);
207 207
208 // Returns true if |second_timestamp| is the timestamp of the next buffer in 208 // Returns true if |second_timestamp| is the timestamp of the next buffer in
209 // sequence after |first_timestamp|, false otherwise. 209 // sequence after |first_timestamp|, false otherwise.
210 bool AreAdjacentInSequence( 210 bool AreAdjacentInSequence(
211 DecodeTimestamp first_timestamp, DecodeTimestamp second_timestamp) const; 211 DecodeTimestamp first_timestamp, DecodeTimestamp second_timestamp) const;
212 212
213 // Helper method that returns the timestamp for the next buffer that 213 // Helper method that returns the timestamp for the next buffer that
214 // |selected_range_| will return from GetNextBuffer() call, or kNoTimestamp() 214 // |selected_range_| will return from GetNextBuffer() call, or kNoTimestamp
215 // if in between seeking (i.e. |selected_range_| is null). 215 // if in between seeking (i.e. |selected_range_| is null).
216 DecodeTimestamp GetNextBufferTimestamp(); 216 DecodeTimestamp GetNextBufferTimestamp();
217 217
218 // Finds the range that should contain a coded frame group that begins with 218 // Finds the range that should contain a coded frame group that begins with
219 // |start_timestamp| and returns the iterator pointing to it. Returns 219 // |start_timestamp| and returns the iterator pointing to it. Returns
220 // |ranges_.end()| if there's no such existing range. 220 // |ranges_.end()| if there's no such existing range.
221 RangeList::iterator FindExistingRangeFor(DecodeTimestamp start_timestamp); 221 RangeList::iterator FindExistingRangeFor(DecodeTimestamp start_timestamp);
222 222
223 // Inserts |new_range| into |ranges_| preserving sorted order. Returns an 223 // Inserts |new_range| into |ranges_| preserving sorted order. Returns an
224 // iterator in |ranges_| that points to |new_range|. 224 // iterator in |ranges_| that points to |new_range|.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 void CompleteConfigChange(); 265 void CompleteConfigChange();
266 266
267 // Sets |selected_range_| and seeks to the nearest keyframe after 267 // Sets |selected_range_| and seeks to the nearest keyframe after
268 // |timestamp| if necessary and possible. This method only attempts to 268 // |timestamp| if necessary and possible. This method only attempts to
269 // set |selected_range_| if |seleted_range_| is null and |track_buffer_| 269 // set |selected_range_| if |seleted_range_| is null and |track_buffer_|
270 // is empty. 270 // is empty.
271 void SetSelectedRangeIfNeeded(const DecodeTimestamp timestamp); 271 void SetSelectedRangeIfNeeded(const DecodeTimestamp timestamp);
272 272
273 // Find a keyframe timestamp that is >= |start_timestamp| and can be used to 273 // Find a keyframe timestamp that is >= |start_timestamp| and can be used to
274 // find a new selected range. 274 // find a new selected range.
275 // Returns kNoTimestamp() if an appropriate keyframe timestamp could not be 275 // Returns kNoTimestamp if an appropriate keyframe timestamp could not be
276 // found. 276 // found.
277 DecodeTimestamp FindNewSelectedRangeSeekTimestamp( 277 DecodeTimestamp FindNewSelectedRangeSeekTimestamp(
278 const DecodeTimestamp start_timestamp); 278 const DecodeTimestamp start_timestamp);
279 279
280 // Searches |ranges_| for the first keyframe timestamp that is >= |timestamp|. 280 // Searches |ranges_| for the first keyframe timestamp that is >= |timestamp|.
281 // If |ranges_| doesn't contain a GOP that covers |timestamp| or doesn't 281 // If |ranges_| doesn't contain a GOP that covers |timestamp| or doesn't
282 // have a keyframe after |timestamp| then kNoTimestamp() is returned. 282 // have a keyframe after |timestamp| then kNoTimestamp is returned.
283 DecodeTimestamp FindKeyframeAfterTimestamp(const DecodeTimestamp timestamp); 283 DecodeTimestamp FindKeyframeAfterTimestamp(const DecodeTimestamp timestamp);
284 284
285 // Returns "VIDEO" for a video SourceBufferStream, "AUDIO" for an audio 285 // Returns "VIDEO" for a video SourceBufferStream, "AUDIO" for an audio
286 // stream, and "TEXT" for a text stream. 286 // stream, and "TEXT" for a text stream.
287 std::string GetStreamTypeName() const; 287 std::string GetStreamTypeName() const;
288 288
289 // Returns true if end of stream has been reached, i.e. the 289 // Returns true if end of stream has been reached, i.e. the
290 // following conditions are met: 290 // following conditions are met:
291 // 1. end of stream is marked and there is nothing in the track_buffer. 291 // 1. end of stream is marked and there is nothing in the track_buffer.
292 // 2. We don't have any ranges, or the last or no range is selected, 292 // 2. We don't have any ranges, or the last or no range is selected,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // appended. 412 // appended.
413 RangeList::iterator range_for_next_append_; 413 RangeList::iterator range_for_next_append_;
414 414
415 // True when the next call to Append() begins a new coded frame group. 415 // True when the next call to Append() begins a new coded frame group.
416 // TODO(wolenetz): Simplify by passing this flag into Append(). 416 // TODO(wolenetz): Simplify by passing this flag into Append().
417 bool new_coded_frame_group_ = false; 417 bool new_coded_frame_group_ = false;
418 418
419 // The timestamp of the last buffer appended to the coded frame group, set to 419 // The timestamp of the last buffer appended to the coded frame group, set to
420 // kNoDecodeTimestamp() if the beginning of the group. 420 // kNoDecodeTimestamp() if the beginning of the group.
421 DecodeTimestamp last_appended_buffer_timestamp_ = kNoDecodeTimestamp(); 421 DecodeTimestamp last_appended_buffer_timestamp_ = kNoDecodeTimestamp();
422 base::TimeDelta last_appended_buffer_duration_ = kNoTimestamp(); 422 base::TimeDelta last_appended_buffer_duration_ = kNoTimestamp;
423 bool last_appended_buffer_is_keyframe_ = false; 423 bool last_appended_buffer_is_keyframe_ = false;
424 424
425 // The decode timestamp on the last buffer returned by the most recent 425 // The decode timestamp on the last buffer returned by the most recent
426 // GetNextBuffer() call. Set to kNoDecodeTimestamp() if GetNextBuffer() hasn't 426 // GetNextBuffer() call. Set to kNoDecodeTimestamp() if GetNextBuffer() hasn't
427 // been called yet or a seek has happened since the last GetNextBuffer() call. 427 // been called yet or a seek has happened since the last GetNextBuffer() call.
428 DecodeTimestamp last_output_buffer_timestamp_; 428 DecodeTimestamp last_output_buffer_timestamp_;
429 429
430 // Stores the largest distance between two adjacent buffers in this stream. 430 // Stores the largest distance between two adjacent buffers in this stream.
431 base::TimeDelta max_interbuffer_distance_; 431 base::TimeDelta max_interbuffer_distance_;
432 432
(...skipping 27 matching lines...) Expand all
460 int num_track_buffer_gap_warning_logs_ = 0; 460 int num_track_buffer_gap_warning_logs_ = 0;
461 int num_garbage_collect_algorithm_logs_ = 0; 461 int num_garbage_collect_algorithm_logs_ = 0;
462 int num_strange_same_timestamps_logs_ = 0; 462 int num_strange_same_timestamps_logs_ = 0;
463 463
464 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); 464 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream);
465 }; 465 };
466 466
467 } // namespace media 467 } // namespace media
468 468
469 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ 469 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698