Index: media/base/stream_parser_buffer.cc |
diff --git a/media/base/stream_parser_buffer.cc b/media/base/stream_parser_buffer.cc |
index 469a4a8dcaf0a91d7cf1e0bcba32d0ef58b36f67..f7af7cd704189984b5c7eb22c678ff1eddf7a7c3 100644 |
--- a/media/base/stream_parser_buffer.cc |
+++ b/media/base/stream_parser_buffer.cc |
@@ -12,36 +12,6 @@ |
namespace media { |
-static scoped_refptr<StreamParserBuffer> CopyBuffer( |
- const StreamParserBuffer& buffer) { |
- if (buffer.end_of_stream()) |
- return StreamParserBuffer::CreateEOSBuffer(); |
- |
- scoped_refptr<StreamParserBuffer> copied_buffer = |
- StreamParserBuffer::CopyFrom(buffer.data(), |
- buffer.data_size(), |
- buffer.side_data(), |
- buffer.side_data_size(), |
- buffer.is_key_frame(), |
- buffer.type(), |
- buffer.track_id()); |
- copied_buffer->SetDecodeTimestamp(buffer.GetDecodeTimestamp()); |
- copied_buffer->SetConfigId(buffer.GetConfigId()); |
- copied_buffer->set_timestamp(buffer.timestamp()); |
- copied_buffer->set_duration(buffer.duration()); |
- copied_buffer->set_is_duration_estimated(buffer.is_duration_estimated()); |
- copied_buffer->set_discard_padding(buffer.discard_padding()); |
- copied_buffer->set_splice_timestamp(buffer.splice_timestamp()); |
- const DecryptConfig* decrypt_config = buffer.decrypt_config(); |
- if (decrypt_config) { |
- copied_buffer->set_decrypt_config(base::MakeUnique<DecryptConfig>( |
- decrypt_config->key_id(), decrypt_config->iv(), |
- decrypt_config->subsamples())); |
- } |
- |
- return copied_buffer; |
-} |
- |
scoped_refptr<StreamParserBuffer> StreamParserBuffer::CreateEOSBuffer() { |
return make_scoped_refptr(new StreamParserBuffer(NULL, 0, NULL, 0, false, |
DemuxerStream::UNKNOWN, 0)); |
@@ -119,12 +89,6 @@ void StreamParserBuffer::SetConfigId(int config_id) { |
preroll_buffer_->SetConfigId(config_id); |
} |
-int StreamParserBuffer::GetSpliceBufferConfigId(size_t index) const { |
- return index < splice_buffers().size() |
- ? splice_buffers_[index]->GetConfigId() |
- : GetConfigId(); |
-} |
- |
const char* StreamParserBuffer::GetTypeName() const { |
switch (type()) { |
case DemuxerStream::AUDIO: |
@@ -140,84 +104,12 @@ const char* StreamParserBuffer::GetTypeName() const { |
return ""; |
} |
-void StreamParserBuffer::ConvertToSpliceBuffer( |
- const BufferQueue& pre_splice_buffers) { |
- DCHECK(splice_buffers_.empty()); |
- DCHECK(duration() > base::TimeDelta()) |
- << "Only buffers with a valid duration can convert to a splice buffer." |
- << " pts " << timestamp().InSecondsF() |
- << " dts " << GetDecodeTimestamp().InSecondsF() |
- << " dur " << duration().InSecondsF(); |
- DCHECK(!end_of_stream()); |
- |
- // Splicing requires non-estimated sample accurate durations to be confident |
- // things will sound smooth. Also, we cannot be certain whether estimated |
- // overlap is really a splice scenario, or just over estimation. |
- DCHECK(!is_duration_estimated_); |
- |
- // Make a copy of this first, before making any changes. |
- scoped_refptr<StreamParserBuffer> overlapping_buffer = CopyBuffer(*this); |
- overlapping_buffer->set_splice_timestamp(kNoTimestamp); |
- |
- const scoped_refptr<StreamParserBuffer>& first_splice_buffer = |
- pre_splice_buffers.front(); |
- |
- // Ensure the given buffers are actually before the splice point. |
- DCHECK(first_splice_buffer->timestamp() <= overlapping_buffer->timestamp()); |
- |
- // TODO(dalecurtis): We should also clear |data| and |side_data|, but since |
- // that implies EOS care must be taken to ensure there are no clients relying |
- // on that behavior. |
- |
- // Move over any preroll from this buffer. |
- if (preroll_buffer_.get()) { |
- DCHECK(!overlapping_buffer->preroll_buffer_.get()); |
- overlapping_buffer->preroll_buffer_.swap(preroll_buffer_); |
- } |
- |
- // Rewrite |this| buffer as a splice buffer. |
- SetDecodeTimestamp(first_splice_buffer->GetDecodeTimestamp()); |
- SetConfigId(first_splice_buffer->GetConfigId()); |
- set_timestamp(first_splice_buffer->timestamp()); |
- set_is_key_frame(first_splice_buffer->is_key_frame()); |
- type_ = first_splice_buffer->type(); |
- track_id_ = first_splice_buffer->track_id(); |
- set_splice_timestamp(overlapping_buffer->timestamp()); |
- |
- // The splice duration is the duration of all buffers before the splice plus |
- // the highest ending timestamp after the splice point. |
- DCHECK(overlapping_buffer->duration() > base::TimeDelta()); |
- DCHECK(pre_splice_buffers.back()->duration() > base::TimeDelta()); |
- set_duration( |
- std::max(overlapping_buffer->timestamp() + overlapping_buffer->duration(), |
- pre_splice_buffers.back()->timestamp() + |
- pre_splice_buffers.back()->duration()) - |
- first_splice_buffer->timestamp()); |
- |
- // Copy all pre splice buffers into our wrapper buffer. |
- for (BufferQueue::const_iterator it = pre_splice_buffers.begin(); |
- it != pre_splice_buffers.end(); |
- ++it) { |
- const scoped_refptr<StreamParserBuffer>& buffer = *it; |
- DCHECK(!buffer->end_of_stream()); |
- DCHECK(!buffer->preroll_buffer().get()); |
- DCHECK(buffer->splice_buffers().empty()); |
- DCHECK(!buffer->is_duration_estimated()); |
- splice_buffers_.push_back(CopyBuffer(*buffer.get())); |
- splice_buffers_.back()->set_splice_timestamp(splice_timestamp()); |
- } |
- |
- splice_buffers_.push_back(overlapping_buffer); |
-} |
- |
void StreamParserBuffer::SetPrerollBuffer( |
const scoped_refptr<StreamParserBuffer>& preroll_buffer) { |
DCHECK(!preroll_buffer_.get()); |
DCHECK(!end_of_stream()); |
DCHECK(!preroll_buffer->end_of_stream()); |
DCHECK(!preroll_buffer->preroll_buffer_.get()); |
- DCHECK(preroll_buffer->splice_timestamp() == kNoTimestamp); |
- DCHECK(preroll_buffer->splice_buffers().empty()); |
DCHECK(preroll_buffer->timestamp() <= timestamp()); |
DCHECK(preroll_buffer->discard_padding() == DecoderBuffer::DiscardPadding()); |
DCHECK_EQ(preroll_buffer->type(), type()); |
@@ -225,6 +117,7 @@ void StreamParserBuffer::SetPrerollBuffer( |
preroll_buffer_ = preroll_buffer; |
preroll_buffer_->set_timestamp(timestamp()); |
+ preroll_buffer_->SetConfigId(GetConfigId()); |
chcunningham
2016/11/11 00:50:50
This seemed to be missing. Probably not critical.
|
preroll_buffer_->SetDecodeTimestamp(GetDecodeTimestamp()); |
// Mark the entire buffer for discard. |