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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 bool SourceBufferStream::IsMonotonicallyIncreasing( | 710 bool SourceBufferStream::IsMonotonicallyIncreasing( |
711 const BufferQueue& buffers) const { | 711 const BufferQueue& buffers) const { |
712 DCHECK(!buffers.empty()); | 712 DCHECK(!buffers.empty()); |
713 base::TimeDelta prev_timestamp = last_appended_buffer_timestamp_; | 713 base::TimeDelta prev_timestamp = last_appended_buffer_timestamp_; |
714 bool prev_is_keyframe = last_appended_buffer_is_keyframe_; | 714 bool prev_is_keyframe = last_appended_buffer_is_keyframe_; |
715 for (BufferQueue::const_iterator itr = buffers.begin(); | 715 for (BufferQueue::const_iterator itr = buffers.begin(); |
716 itr != buffers.end(); ++itr) { | 716 itr != buffers.end(); ++itr) { |
717 base::TimeDelta current_timestamp = (*itr)->GetDecodeTimestamp(); | 717 base::TimeDelta current_timestamp = (*itr)->GetDecodeTimestamp(); |
718 bool current_is_keyframe = (*itr)->IsKeyframe(); | 718 bool current_is_keyframe = (*itr)->IsKeyframe(); |
719 DCHECK(current_timestamp != kNoTimestamp()); | 719 DCHECK(current_timestamp != kNoTimestamp()); |
| 720 DCHECK((*itr)->duration() >= base::TimeDelta()) |
| 721 << "Packet with invalid duration." |
| 722 << " pts " << (*itr)->timestamp().InSecondsF() |
| 723 << " dts " << (*itr)->GetDecodeTimestamp().InSecondsF() |
| 724 << " dur " << (*itr)->duration().InSecondsF(); |
720 | 725 |
721 if (prev_timestamp != kNoTimestamp()) { | 726 if (prev_timestamp != kNoTimestamp()) { |
722 if (current_timestamp < prev_timestamp) { | 727 if (current_timestamp < prev_timestamp) { |
723 MEDIA_LOG(log_cb_) << "Buffers were not monotonically increasing."; | 728 MEDIA_LOG(log_cb_) << "Buffers were not monotonically increasing."; |
724 return false; | 729 return false; |
725 } | 730 } |
726 | 731 |
727 if (current_timestamp == prev_timestamp && | 732 if (current_timestamp == prev_timestamp && |
728 !AllowSameTimestamp(prev_is_keyframe, current_is_keyframe, | 733 !AllowSameTimestamp(prev_is_keyframe, current_is_keyframe, |
729 GetType())) { | 734 GetType())) { |
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 return false; | 2267 return false; |
2263 | 2268 |
2264 DCHECK_NE(have_splice_buffers, have_preroll_buffer); | 2269 DCHECK_NE(have_splice_buffers, have_preroll_buffer); |
2265 splice_buffers_index_ = 0; | 2270 splice_buffers_index_ = 0; |
2266 pending_buffer_.swap(*out_buffer); | 2271 pending_buffer_.swap(*out_buffer); |
2267 pending_buffers_complete_ = false; | 2272 pending_buffers_complete_ = false; |
2268 return true; | 2273 return true; |
2269 } | 2274 } |
2270 | 2275 |
2271 } // namespace media | 2276 } // namespace media |
OLD | NEW |