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 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 if (current_range->LastGOPContainsNextBufferPosition()) { | 848 if (current_range->LastGOPContainsNextBufferPosition()) { |
849 DCHECK_EQ(current_range, selected_range_); | 849 DCHECK_EQ(current_range, selected_range_); |
850 DVLOG(5) << "current_range contains next read position, stopping GC"; | 850 DVLOG(5) << "current_range contains next read position, stopping GC"; |
851 break; | 851 break; |
852 } | 852 } |
853 DVLOG(5) << "Deleting GOP from back: " << RangeToString(*current_range); | 853 DVLOG(5) << "Deleting GOP from back: " << RangeToString(*current_range); |
854 bytes_deleted = current_range->DeleteGOPFromBack(&buffers); | 854 bytes_deleted = current_range->DeleteGOPFromBack(&buffers); |
855 } else { | 855 } else { |
856 current_range = ranges_.front(); | 856 current_range = ranges_.front(); |
857 DVLOG(5) << "current_range=" << RangeToString(*current_range); | 857 DVLOG(5) << "current_range=" << RangeToString(*current_range); |
858 if (!current_range->FirstGOPEarlierThanMediaTime(media_time)) { | 858 if (!current_range->FirstGOPEarlierThanMediaTime(media_time) || |
| 859 current_range->FirstGOPContainsNextBufferPosition()) { |
859 // We have removed all data up to the GOP that contains current playback | 860 // We have removed all data up to the GOP that contains current playback |
860 // position, we can't delete any further. | 861 // position, we can't delete any further. |
861 DVLOG(5) << "current_range contains playback position, stopping GC"; | 862 DVLOG(5) << "current_range contains playback position, stopping GC"; |
862 break; | 863 break; |
863 } | 864 } |
864 DVLOG(4) << "Deleting GOP from front: " << RangeToString(*current_range); | 865 DVLOG(4) << "Deleting GOP from front: " << RangeToString(*current_range) |
| 866 << ", media_time: " << media_time.InMicroseconds() |
| 867 << ", current_range->HasNextBufferPosition(): " |
| 868 << current_range->HasNextBufferPosition(); |
865 bytes_deleted = current_range->DeleteGOPFromFront(&buffers); | 869 bytes_deleted = current_range->DeleteGOPFromFront(&buffers); |
866 } | 870 } |
867 | 871 |
868 // Check to see if we've just deleted the GOP that was last appended. | 872 // Check to see if we've just deleted the GOP that was last appended. |
869 DecodeTimestamp end_timestamp = buffers.back()->GetDecodeTimestamp(); | 873 DecodeTimestamp end_timestamp = buffers.back()->GetDecodeTimestamp(); |
870 if (end_timestamp == last_appended_buffer_timestamp_) { | 874 if (end_timestamp == last_appended_buffer_timestamp_) { |
871 DCHECK(last_appended_buffer_timestamp_ != kNoDecodeTimestamp()); | 875 DCHECK(last_appended_buffer_timestamp_ != kNoDecodeTimestamp()); |
872 DCHECK(!new_range_for_append); | 876 DCHECK(!new_range_for_append); |
873 | 877 |
874 // Create a new range containing these buffers. | 878 // Create a new range containing these buffers. |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 return false; | 1786 return false; |
1783 | 1787 |
1784 DCHECK_NE(have_splice_buffers, have_preroll_buffer); | 1788 DCHECK_NE(have_splice_buffers, have_preroll_buffer); |
1785 splice_buffers_index_ = 0; | 1789 splice_buffers_index_ = 0; |
1786 pending_buffer_.swap(*out_buffer); | 1790 pending_buffer_.swap(*out_buffer); |
1787 pending_buffers_complete_ = false; | 1791 pending_buffers_complete_ = false; |
1788 return true; | 1792 return true; |
1789 } | 1793 } |
1790 | 1794 |
1791 } // namespace media | 1795 } // namespace media |
OLD | NEW |