| OLD | NEW |
| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // is wrong with the content. | 341 // is wrong with the content. |
| 342 scoped_refptr<MediaLog> media_log_; | 342 scoped_refptr<MediaLog> media_log_; |
| 343 | 343 |
| 344 // List of disjoint buffered ranges, ordered by start time. | 344 // List of disjoint buffered ranges, ordered by start time. |
| 345 RangeList ranges_; | 345 RangeList ranges_; |
| 346 | 346 |
| 347 // Indicates which decoder config is being used by the decoder. | 347 // Indicates which decoder config is being used by the decoder. |
| 348 // GetNextBuffer() is only allows to return buffers that have a | 348 // GetNextBuffer() is only allows to return buffers that have a |
| 349 // config ID that matches this index. If there is a mismatch then | 349 // config ID that matches this index. If there is a mismatch then |
| 350 // it must signal that a config change is needed. | 350 // it must signal that a config change is needed. |
| 351 int current_config_index_; | 351 int current_config_index_ = 0; |
| 352 | 352 |
| 353 // Indicates which decoder config to associate with new buffers | 353 // Indicates which decoder config to associate with new buffers |
| 354 // being appended. Each new buffer appended has its config ID set | 354 // being appended. Each new buffer appended has its config ID set |
| 355 // to the value of this field. | 355 // to the value of this field. |
| 356 int append_config_index_; | 356 int append_config_index_ = 0; |
| 357 | 357 |
| 358 // Holds the audio/video configs for this stream. |current_config_index_| | 358 // Holds the audio/video configs for this stream. |current_config_index_| |
| 359 // and |append_config_index_| represent indexes into one of these vectors. | 359 // and |append_config_index_| represent indexes into one of these vectors. |
| 360 std::vector<AudioDecoderConfig> audio_configs_; | 360 std::vector<AudioDecoderConfig> audio_configs_; |
| 361 std::vector<VideoDecoderConfig> video_configs_; | 361 std::vector<VideoDecoderConfig> video_configs_; |
| 362 | 362 |
| 363 // Holds the text config for this stream. | 363 // Holds the text config for this stream. |
| 364 TextTrackConfig text_track_config_; | 364 TextTrackConfig text_track_config_; |
| 365 | 365 |
| 366 // True if more data needs to be appended before the Seek() can complete, | 366 // True if more data needs to be appended before the Seek() can complete, |
| 367 // false if no Seek() has been requested or the Seek() is completed. | 367 // false if no Seek() has been requested or the Seek() is completed. |
| 368 bool seek_pending_; | 368 bool seek_pending_ = false; |
| 369 | 369 |
| 370 // True if the end of the stream has been signalled. | 370 // True if the end of the stream has been signalled. |
| 371 bool end_of_stream_; | 371 bool end_of_stream_ = false; |
| 372 | 372 |
| 373 // Timestamp of the last request to Seek(). | 373 // Timestamp of the last request to Seek(). |
| 374 base::TimeDelta seek_buffer_timestamp_; | 374 base::TimeDelta seek_buffer_timestamp_; |
| 375 | 375 |
| 376 // 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 |
| 377 // GetNextBuffer() calls are fulfilled after the |track_buffer_| has been | 377 // GetNextBuffer() calls are fulfilled after the |track_buffer_| has been |
| 378 // emptied. | 378 // emptied. |
| 379 SourceBufferRange* selected_range_; | 379 SourceBufferRange* selected_range_ = nullptr; |
| 380 | 380 |
| 381 // 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 |
| 382 // |track_buffer_| is empty, return buffers from |selected_range_|. | 382 // |track_buffer_| is empty, return buffers from |selected_range_|. |
| 383 BufferQueue track_buffer_; | 383 BufferQueue track_buffer_; |
| 384 | 384 |
| 385 // If there has been no intervening Seek, this will be true if the last | 385 // If there has been no intervening Seek, this will be true if the last |
| 386 // emitted buffer emptied |track_buffer_|. | 386 // emitted buffer emptied |track_buffer_|. |
| 387 bool just_exhausted_track_buffer_; | 387 bool just_exhausted_track_buffer_ = false; |
| 388 | 388 |
| 389 // The start time of the current media segment being appended. | 389 // The start time of the current media segment being appended. |
| 390 DecodeTimestamp media_segment_start_time_; | 390 DecodeTimestamp media_segment_start_time_; |
| 391 | 391 |
| 392 // Points to the range containing the current media segment being appended. | 392 // Points to the range containing the current media segment being appended. |
| 393 RangeList::iterator range_for_next_append_; | 393 RangeList::iterator range_for_next_append_; |
| 394 | 394 |
| 395 // 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. |
| 396 bool new_media_segment_; | 396 bool new_media_segment_ = false; |
| 397 | 397 |
| 398 // 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 |
| 399 // kNoDecodeTimestamp() if the beginning of the segment. | 399 // kNoDecodeTimestamp() if the beginning of the segment. |
| 400 DecodeTimestamp last_appended_buffer_timestamp_; | 400 DecodeTimestamp last_appended_buffer_timestamp_; |
| 401 bool last_appended_buffer_is_keyframe_; | 401 bool last_appended_buffer_is_keyframe_ = false; |
| 402 | 402 |
| 403 // The decode timestamp on the last buffer returned by the most recent | 403 // The decode timestamp on the last buffer returned by the most recent |
| 404 // GetNextBuffer() call. Set to kNoDecodeTimestamp() if GetNextBuffer() hasn't | 404 // GetNextBuffer() call. Set to kNoDecodeTimestamp() if GetNextBuffer() hasn't |
| 405 // been called yet or a seek has happened since the last GetNextBuffer() call. | 405 // been called yet or a seek has happened since the last GetNextBuffer() call. |
| 406 DecodeTimestamp last_output_buffer_timestamp_; | 406 DecodeTimestamp last_output_buffer_timestamp_; |
| 407 | 407 |
| 408 // Stores the largest distance between two adjacent buffers in this stream. | 408 // Stores the largest distance between two adjacent buffers in this stream. |
| 409 base::TimeDelta max_interbuffer_distance_; | 409 base::TimeDelta max_interbuffer_distance_; |
| 410 | 410 |
| 411 // The maximum amount of data in bytes the stream will keep in memory. | 411 // The maximum amount of data in bytes the stream will keep in memory. |
| 412 size_t memory_limit_; | 412 size_t memory_limit_; |
| 413 | 413 |
| 414 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() | 414 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() |
| 415 // and GetCurrentXXXDecoderConfig() must be called to update the current | 415 // and GetCurrentXXXDecoderConfig() must be called to update the current |
| 416 // config. GetNextBuffer() must not be called again until | 416 // config. GetNextBuffer() must not be called again until |
| 417 // GetCurrentXXXDecoderConfig() has been called. | 417 // GetCurrentXXXDecoderConfig() has been called. |
| 418 bool config_change_pending_; | 418 bool config_change_pending_ = false; |
| 419 | 419 |
| 420 // Used by HandleNextBufferWithSplice() or HandleNextBufferWithPreroll() when | 420 // Used by HandleNextBufferWithSplice() or HandleNextBufferWithPreroll() when |
| 421 // a splice frame buffer or buffer with preroll is returned from | 421 // a splice frame buffer or buffer with preroll is returned from |
| 422 // GetNextBufferInternal(). | 422 // GetNextBufferInternal(). |
| 423 scoped_refptr<StreamParserBuffer> pending_buffer_; | 423 scoped_refptr<StreamParserBuffer> pending_buffer_; |
| 424 | 424 |
| 425 // Indicates which of the splice buffers in |splice_buffer_| should be | 425 // Indicates which of the splice buffers in |splice_buffer_| should be |
| 426 // handled out next. | 426 // handled out next. |
| 427 size_t splice_buffers_index_; | 427 size_t splice_buffers_index_ = 0; |
| 428 | 428 |
| 429 // Indicates that all buffers before |pending_buffer_| have been handed out. | 429 // Indicates that all buffers before |pending_buffer_| have been handed out. |
| 430 bool pending_buffers_complete_; | 430 bool pending_buffers_complete_ = false; |
| 431 | 431 |
| 432 // Indicates that splice frame generation is enabled. | 432 // Indicates that splice frame generation is enabled. |
| 433 const bool splice_frames_enabled_; | 433 const bool splice_frames_enabled_; |
| 434 | 434 |
| 435 // To prevent log spam, count the number of warnings and successes logged. | 435 // To prevent log spam, count the number of warnings and successes logged. |
| 436 int num_splice_generation_warning_logs_; | 436 int num_splice_generation_warning_logs_ = 0; |
| 437 int num_splice_generation_success_logs_; | 437 int num_splice_generation_success_logs_ = 0; |
| 438 int num_track_buffer_gap_warning_logs_; | 438 int num_track_buffer_gap_warning_logs_ = 0; |
| 439 | 439 |
| 440 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); | 440 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); |
| 441 }; | 441 }; |
| 442 | 442 |
| 443 } // namespace media | 443 } // namespace media |
| 444 | 444 |
| 445 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 445 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
| OLD | NEW |