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(); | |
725 | 720 |
726 if (prev_timestamp != kNoTimestamp()) { | 721 if (prev_timestamp != kNoTimestamp()) { |
727 if (current_timestamp < prev_timestamp) { | 722 if (current_timestamp < prev_timestamp) { |
728 MEDIA_LOG(log_cb_) << "Buffers were not monotonically increasing."; | 723 MEDIA_LOG(log_cb_) << "Buffers were not monotonically increasing."; |
729 return false; | 724 return false; |
730 } | 725 } |
731 | 726 |
732 if (current_timestamp == prev_timestamp && | 727 if (current_timestamp == prev_timestamp && |
733 !AllowSameTimestamp(prev_is_keyframe, current_is_keyframe, | 728 !AllowSameTimestamp(prev_is_keyframe, current_is_keyframe, |
734 GetType())) { | 729 GetType())) { |
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 return false; | 2262 return false; |
2268 | 2263 |
2269 DCHECK_NE(have_splice_buffers, have_preroll_buffer); | 2264 DCHECK_NE(have_splice_buffers, have_preroll_buffer); |
2270 splice_buffers_index_ = 0; | 2265 splice_buffers_index_ = 0; |
2271 pending_buffer_.swap(*out_buffer); | 2266 pending_buffer_.swap(*out_buffer); |
2272 pending_buffers_complete_ = false; | 2267 pending_buffers_complete_ = false; |
2273 return true; | 2268 return true; |
2274 } | 2269 } |
2275 | 2270 |
2276 } // namespace media | 2271 } // namespace media |
OLD | NEW |