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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 } | 440 } |
441 } | 441 } |
442 | 442 |
443 bool SourceBufferStream::Append(const BufferQueue& buffers) { | 443 bool SourceBufferStream::Append(const BufferQueue& buffers) { |
444 TRACE_EVENT2("media", "SourceBufferStream::Append", | 444 TRACE_EVENT2("media", "SourceBufferStream::Append", |
445 "stream type", GetStreamTypeName(), | 445 "stream type", GetStreamTypeName(), |
446 "buffers to append", buffers.size()); | 446 "buffers to append", buffers.size()); |
447 | 447 |
448 DCHECK(!buffers.empty()); | 448 DCHECK(!buffers.empty()); |
449 DCHECK(media_segment_start_time_ != kNoTimestamp()); | 449 DCHECK(media_segment_start_time_ != kNoTimestamp()); |
| 450 DCHECK(media_segment_start_time_ <= buffers.front()->GetDecodeTimestamp()); |
450 DCHECK(!end_of_stream_); | 451 DCHECK(!end_of_stream_); |
451 | 452 |
452 // New media segments must begin with a keyframe. | 453 // New media segments must begin with a keyframe. |
453 if (new_media_segment_ && !buffers.front()->IsKeyframe()) { | 454 if (new_media_segment_ && !buffers.front()->IsKeyframe()) { |
454 MEDIA_LOG(log_cb_) << "Media segment did not begin with keyframe."; | 455 MEDIA_LOG(log_cb_) << "Media segment did not begin with keyframe."; |
455 return false; | 456 return false; |
456 } | 457 } |
457 | 458 |
458 // Buffers within a media segment should be monotonically increasing. | 459 // Buffers within a media segment should be monotonically increasing. |
459 if (!IsMonotonicallyIncreasing(buffers)) | 460 if (!IsMonotonicallyIncreasing(buffers)) |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2180 if (buffer->end_of_stream() || buffer->timestamp() >= end) | 2181 if (buffer->end_of_stream() || buffer->timestamp() >= end) |
2181 break; | 2182 break; |
2182 if (buffer->timestamp() + buffer->duration() <= start) | 2183 if (buffer->timestamp() + buffer->duration() <= start) |
2183 continue; | 2184 continue; |
2184 buffers->push_back(buffer); | 2185 buffers->push_back(buffer); |
2185 } | 2186 } |
2186 return previous_size < buffers->size(); | 2187 return previous_size < buffers->size(); |
2187 } | 2188 } |
2188 | 2189 |
2189 } // namespace media | 2190 } // namespace media |
OLD | NEW |