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

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

Issue 1281113002: MSE: Warn when keyframe after track_buffer is significantly in future (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes xhwang@'s nits Created 5 years, 4 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // See GetNextBuffer() for additional details. This method handles preroll 312 // See GetNextBuffer() for additional details. This method handles preroll
313 // frame processing. 313 // frame processing.
314 Status HandleNextBufferWithPreroll( 314 Status HandleNextBufferWithPreroll(
315 scoped_refptr<StreamParserBuffer>* out_buffer); 315 scoped_refptr<StreamParserBuffer>* out_buffer);
316 316
317 // See GetNextBuffer() for additional details. The internal method hands out 317 // See GetNextBuffer() for additional details. The internal method hands out
318 // single buffers from the |track_buffer_| and |selected_range_| without 318 // single buffers from the |track_buffer_| and |selected_range_| without
319 // additional processing for splice frame or preroll buffers. 319 // additional processing for splice frame or preroll buffers.
320 Status GetNextBufferInternal(scoped_refptr<StreamParserBuffer>* out_buffer); 320 Status GetNextBufferInternal(scoped_refptr<StreamParserBuffer>* out_buffer);
321 321
322 // If the next buffer's timestamp is significantly beyond the last output
323 // buffer, and if we just exhausted |track_buffer_| on the previous read, this
324 // method logs a warning to |media_log_| that there could be perceivable
325 // delay. Apps can avoid this behavior by not overlap-appending buffers near
326 // current playback position.
327 void WarnIfTrackBufferExhaustionSkipsForward(
328 const scoped_refptr<StreamParserBuffer>& next_buffer);
329
322 // Called by PrepareRangesForNextAppend() before pruning overlapped buffers to 330 // Called by PrepareRangesForNextAppend() before pruning overlapped buffers to
323 // generate a splice frame with a small portion of the overlapped buffers. If 331 // generate a splice frame with a small portion of the overlapped buffers. If
324 // a splice frame is generated, the first buffer in |new_buffers| will have 332 // a splice frame is generated, the first buffer in |new_buffers| will have
325 // its timestamps, duration, and fade out preroll updated. 333 // its timestamps, duration, and fade out preroll updated.
326 void GenerateSpliceFrame(const BufferQueue& new_buffers); 334 void GenerateSpliceFrame(const BufferQueue& new_buffers);
327 335
328 // If |out_buffer| has splice buffers or preroll, sets |pending_buffer_| 336 // If |out_buffer| has splice buffers or preroll, sets |pending_buffer_|
329 // appropriately and returns true. Otherwise returns false. 337 // appropriately and returns true. Otherwise returns false.
330 bool SetPendingBuffer(scoped_refptr<StreamParserBuffer>* out_buffer); 338 bool SetPendingBuffer(scoped_refptr<StreamParserBuffer>* out_buffer);
331 339
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 375
368 // Pointer to the seeked-to Range. This is the range from which 376 // Pointer to the seeked-to Range. This is the range from which
369 // GetNextBuffer() calls are fulfilled after the |track_buffer_| has been 377 // GetNextBuffer() calls are fulfilled after the |track_buffer_| has been
370 // emptied. 378 // emptied.
371 SourceBufferRange* selected_range_; 379 SourceBufferRange* selected_range_;
372 380
373 // Queue of the next buffers to be returned from calls to GetNextBuffer(). If 381 // Queue of the next buffers to be returned from calls to GetNextBuffer(). If
374 // |track_buffer_| is empty, return buffers from |selected_range_|. 382 // |track_buffer_| is empty, return buffers from |selected_range_|.
375 BufferQueue track_buffer_; 383 BufferQueue track_buffer_;
376 384
385 // If there has been no intervening Seek, this will be true if the last
386 // emitted buffer emptied |track_buffer_|.
387 bool just_exhausted_track_buffer_;
388
377 // The start time of the current media segment being appended. 389 // The start time of the current media segment being appended.
378 DecodeTimestamp media_segment_start_time_; 390 DecodeTimestamp media_segment_start_time_;
379 391
380 // Points to the range containing the current media segment being appended. 392 // Points to the range containing the current media segment being appended.
381 RangeList::iterator range_for_next_append_; 393 RangeList::iterator range_for_next_append_;
382 394
383 // True when the next call to Append() begins a new media segment. 395 // True when the next call to Append() begins a new media segment.
384 bool new_media_segment_; 396 bool new_media_segment_;
385 397
386 // The timestamp of the last buffer appended to the media segment, set to 398 // The timestamp of the last buffer appended to the media segment, set to
(...skipping 26 matching lines...) Expand all
413 // Indicates which of the splice buffers in |splice_buffer_| should be 425 // Indicates which of the splice buffers in |splice_buffer_| should be
414 // handled out next. 426 // handled out next.
415 size_t splice_buffers_index_; 427 size_t splice_buffers_index_;
416 428
417 // Indicates that all buffers before |pending_buffer_| have been handed out. 429 // Indicates that all buffers before |pending_buffer_| have been handed out.
418 bool pending_buffers_complete_; 430 bool pending_buffers_complete_;
419 431
420 // Indicates that splice frame generation is enabled. 432 // Indicates that splice frame generation is enabled.
421 const bool splice_frames_enabled_; 433 const bool splice_frames_enabled_;
422 434
423 // To prevent log spam, count the number of splice generation warnings and 435 // To prevent log spam, count the number of warnings and successes logged.
424 // successes logged.
425 int num_splice_generation_warning_logs_; 436 int num_splice_generation_warning_logs_;
426 int num_splice_generation_success_logs_; 437 int num_splice_generation_success_logs_;
438 int num_track_buffer_gap_warning_logs_;
427 439
428 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); 440 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream);
429 }; 441 };
430 442
431 } // namespace media 443 } // namespace media
432 444
433 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ 445 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698