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 #include "media/filters/source_buffer_stream.h" | 5 #include "media/filters/source_buffer_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 RangeList::iterator last_range = range_for_next_append_; | 384 RangeList::iterator last_range = range_for_next_append_; |
385 range_for_next_append_ = FindExistingRangeFor(media_segment_start_time); | 385 range_for_next_append_ = FindExistingRangeFor(media_segment_start_time); |
386 | 386 |
387 // Only reset |last_appended_buffer_timestamp_| if this new media segment is | 387 // Only reset |last_appended_buffer_timestamp_| if this new media segment is |
388 // not adjacent to the previous media segment appended to the stream. | 388 // not adjacent to the previous media segment appended to the stream. |
389 if (range_for_next_append_ == ranges_.end() || | 389 if (range_for_next_append_ == ranges_.end() || |
390 !AreAdjacentInSequence(last_appended_buffer_timestamp_, | 390 !AreAdjacentInSequence(last_appended_buffer_timestamp_, |
391 media_segment_start_time)) { | 391 media_segment_start_time)) { |
392 last_appended_buffer_timestamp_ = kNoTimestamp(); | 392 last_appended_buffer_timestamp_ = kNoTimestamp(); |
393 last_appended_buffer_is_keyframe_ = false; | 393 last_appended_buffer_is_keyframe_ = false; |
394 } else { | 394 } else if (last_range != ranges_.end()) { |
395 DCHECK(last_range == range_for_next_append_); | 395 DCHECK(last_range == range_for_next_append_); |
396 } | 396 } |
397 } | 397 } |
398 | 398 |
399 bool SourceBufferStream::Append( | 399 bool SourceBufferStream::Append( |
400 const SourceBufferStream::BufferQueue& buffers) { | 400 const SourceBufferStream::BufferQueue& buffers) { |
401 TRACE_EVENT2("mse", "SourceBufferStream::Append", | 401 TRACE_EVENT2("mse", "SourceBufferStream::Append", |
402 "stream type", GetStreamTypeName(), | 402 "stream type", GetStreamTypeName(), |
403 "buffers to append", buffers.size()); | 403 "buffers to append", buffers.size()); |
404 | 404 |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 return ComputeFudgeRoom(GetApproximateDuration()); | 1950 return ComputeFudgeRoom(GetApproximateDuration()); |
1951 } | 1951 } |
1952 | 1952 |
1953 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { | 1953 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { |
1954 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); | 1954 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); |
1955 DCHECK(max_interbuffer_distance != kNoTimestamp()); | 1955 DCHECK(max_interbuffer_distance != kNoTimestamp()); |
1956 return max_interbuffer_distance; | 1956 return max_interbuffer_distance; |
1957 } | 1957 } |
1958 | 1958 |
1959 } // namespace media | 1959 } // namespace media |
OLD | NEW |