Chromium Code Reviews| 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 previously pending buffer, returning status " << status; | |
|
wolenetz
2014/12/05 22:13:43
Updated the message for clarity. Still a little gr
| |
| 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 |
| 981 const SourceBufferStream::Status status = | |
| 982 HandleNextBufferWithPreroll(out_buffer); | |
| 970 DCHECK(pending_buffer_->preroll_buffer().get()); | 983 DCHECK(pending_buffer_->preroll_buffer().get()); |
|
wolenetz
2014/12/05 22:13:43
Oops - this DCHECK must be done *before* HandleNex
| |
| 971 return HandleNextBufferWithPreroll(out_buffer); | 984 DVLOG(2) << __FUNCTION__ << " " << GetStreamTypeName() |
| 985 << ": handled next buffer with preroll, returning status " | |
| 986 << status; | |
| 987 return status; | |
| 972 } | 988 } |
| 973 | 989 |
| 974 SourceBufferStream::Status SourceBufferStream::HandleNextBufferWithSplice( | 990 SourceBufferStream::Status SourceBufferStream::HandleNextBufferWithSplice( |
| 975 scoped_refptr<StreamParserBuffer>* out_buffer) { | 991 scoped_refptr<StreamParserBuffer>* out_buffer) { |
| 976 const BufferQueue& splice_buffers = pending_buffer_->splice_buffers(); | 992 const BufferQueue& splice_buffers = pending_buffer_->splice_buffers(); |
| 977 const size_t last_splice_buffer_index = splice_buffers.size() - 1; | 993 const size_t last_splice_buffer_index = splice_buffers.size() - 1; |
| 978 | 994 |
| 979 // Are there any splice buffers left to hand out? The last buffer should be | 995 // 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. | 996 // handed out separately since it represents the first post-splice buffer. |
| 981 if (splice_buffers_index_ < last_splice_buffer_index) { | 997 if (splice_buffers_index_ < last_splice_buffer_index) { |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1545 return false; | 1561 return false; |
| 1546 | 1562 |
| 1547 DCHECK_NE(have_splice_buffers, have_preroll_buffer); | 1563 DCHECK_NE(have_splice_buffers, have_preroll_buffer); |
| 1548 splice_buffers_index_ = 0; | 1564 splice_buffers_index_ = 0; |
| 1549 pending_buffer_.swap(*out_buffer); | 1565 pending_buffer_.swap(*out_buffer); |
| 1550 pending_buffers_complete_ = false; | 1566 pending_buffers_complete_ = false; |
| 1551 return true; | 1567 return true; |
| 1552 } | 1568 } |
| 1553 | 1569 |
| 1554 } // namespace media | 1570 } // namespace media |
| OLD | NEW |