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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 // If we're about to delete the selected range, also reset the seek state. | 951 // If we're about to delete the selected range, also reset the seek state. |
952 DCHECK((*itr)->GetStartTimestamp() >= duration_dts); | 952 DCHECK((*itr)->GetStartTimestamp() >= duration_dts); |
953 if (*itr == selected_range_) | 953 if (*itr == selected_range_) |
954 ResetSeekState(); | 954 ResetSeekState(); |
955 DeleteAndRemoveRange(&itr); | 955 DeleteAndRemoveRange(&itr); |
956 } | 956 } |
957 } | 957 } |
958 | 958 |
959 SourceBufferStream::Status SourceBufferStream::GetNextBuffer( | 959 SourceBufferStream::Status SourceBufferStream::GetNextBuffer( |
960 scoped_refptr<StreamParserBuffer>* out_buffer) { | 960 scoped_refptr<StreamParserBuffer>* out_buffer) { |
| 961 DVLOG(2) << __FUNCTION__ << " " << GetStreamTypeName(); |
961 if (!pending_buffer_.get()) { | 962 if (!pending_buffer_.get()) { |
962 const SourceBufferStream::Status status = GetNextBufferInternal(out_buffer); | 963 const SourceBufferStream::Status status = GetNextBufferInternal(out_buffer); |
963 if (status != SourceBufferStream::kSuccess || !SetPendingBuffer(out_buffer)) | 964 if (status != SourceBufferStream::kSuccess || |
| 965 !SetPendingBuffer(out_buffer)) { |
| 966 DVLOG(2) << __FUNCTION__ << " " << GetStreamTypeName() |
| 967 << ": no pending buffer, returning status " << status; |
964 return status; | 968 return status; |
| 969 } |
965 } | 970 } |
966 | 971 |
967 if (!pending_buffer_->splice_buffers().empty()) | 972 if (!pending_buffer_->splice_buffers().empty()) { |
968 return HandleNextBufferWithSplice(out_buffer); | 973 const SourceBufferStream::Status status = |
| 974 HandleNextBufferWithSplice(out_buffer); |
| 975 DVLOG(2) << __FUNCTION__ << " " << GetStreamTypeName() |
| 976 << ": handled next buffer with splice, returning status " |
| 977 << status; |
| 978 return status; |
| 979 } |
969 | 980 |
970 DCHECK(pending_buffer_->preroll_buffer().get()); | 981 DCHECK(pending_buffer_->preroll_buffer().get()); |
971 return HandleNextBufferWithPreroll(out_buffer); | 982 |
| 983 const SourceBufferStream::Status status = |
| 984 HandleNextBufferWithPreroll(out_buffer); |
| 985 DVLOG(2) << __FUNCTION__ << " " << GetStreamTypeName() |
| 986 << ": handled next buffer with preroll, returning status " |
| 987 << status; |
| 988 return status; |
972 } | 989 } |
973 | 990 |
974 SourceBufferStream::Status SourceBufferStream::HandleNextBufferWithSplice( | 991 SourceBufferStream::Status SourceBufferStream::HandleNextBufferWithSplice( |
975 scoped_refptr<StreamParserBuffer>* out_buffer) { | 992 scoped_refptr<StreamParserBuffer>* out_buffer) { |
976 const BufferQueue& splice_buffers = pending_buffer_->splice_buffers(); | 993 const BufferQueue& splice_buffers = pending_buffer_->splice_buffers(); |
977 const size_t last_splice_buffer_index = splice_buffers.size() - 1; | 994 const size_t last_splice_buffer_index = splice_buffers.size() - 1; |
978 | 995 |
979 // Are there any splice buffers left to hand out? The last buffer should be | 996 // Are there any splice buffers left to hand out? The last buffer should be |
980 // handed out separately since it represents the first post-splice buffer. | 997 // handed out separately since it represents the first post-splice buffer. |
981 if (splice_buffers_index_ < last_splice_buffer_index) { | 998 if (splice_buffers_index_ < last_splice_buffer_index) { |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 return false; | 1562 return false; |
1546 | 1563 |
1547 DCHECK_NE(have_splice_buffers, have_preroll_buffer); | 1564 DCHECK_NE(have_splice_buffers, have_preroll_buffer); |
1548 splice_buffers_index_ = 0; | 1565 splice_buffers_index_ = 0; |
1549 pending_buffer_.swap(*out_buffer); | 1566 pending_buffer_.swap(*out_buffer); |
1550 pending_buffers_complete_ = false; | 1567 pending_buffers_complete_ = false; |
1551 return true; | 1568 return true; |
1552 } | 1569 } |
1553 | 1570 |
1554 } // namespace media | 1571 } // namespace media |
OLD | NEW |