summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authoracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-17 11:24:54 +0000
committeracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-17 11:24:54 +0000
commit42c47a9855330e5d18a71dbe9aebd900fa61f353 (patch)
tree3b946f932f5c65149d20b6755bb5bccc2ed9d653 /media/base
parente7cd037c36a3ac5bab0f66bb10c009c80af53569 (diff)
downloadchromium_src-42c47a9855330e5d18a71dbe9aebd900fa61f353.zip
chromium_src-42c47a9855330e5d18a71dbe9aebd900fa61f353.tar.gz
chromium_src-42c47a9855330e5d18a71dbe9aebd900fa61f353.tar.bz2
Update SourceBufferStream and its unit tests to always expect valid durations.
This change fixes the SourceBufferStream unit tests so that they always provide valid durations for buffers that it passes to SourceBufferStream. I've also added code to SoureBufferStream to verify that it always gets buffers with valid durations. Minor tweaks to test expectations were needed to compensate for the SourceBufferStream behaving differently when it got actual durations instead of using the durations it made up. In most cases I just used the duration the SourceBufferStream was ultimately using. In a few cases the duration the SourceBufferStream was generating didn't make any sense so I simply changed the expectations to match the new behavior. This is an attempt to reland https://codereview.chromium.org/379693002/ with appropriate crash fixes. Review URL: https://codereview.chromium.org/393403002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r--media/base/decoder_buffer.h4
-rw-r--r--media/base/stream_parser_buffer.cc7
2 files changed, 11 insertions, 0 deletions
diff --git a/media/base/decoder_buffer.h b/media/base/decoder_buffer.h
index 27de88f..c17aa21 100644
--- a/media/base/decoder_buffer.h
+++ b/media/base/decoder_buffer.h
@@ -14,6 +14,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "build/build_config.h"
+#include "media/base/buffers.h"
#include "media/base/decrypt_config.h"
#include "media/base/media_export.h"
@@ -77,6 +78,9 @@ class MEDIA_EXPORT DecoderBuffer
void set_duration(base::TimeDelta duration) {
DCHECK(!end_of_stream());
+ DCHECK(duration == kNoTimestamp() ||
+ (duration >= base::TimeDelta() && duration != kInfiniteDuration()))
+ << duration.InSecondsF();
duration_ = duration;
}
diff --git a/media/base/stream_parser_buffer.cc b/media/base/stream_parser_buffer.cc
index e9d6427..ae82659 100644
--- a/media/base/stream_parser_buffer.cc
+++ b/media/base/stream_parser_buffer.cc
@@ -106,6 +106,11 @@ void StreamParserBuffer::SetConfigId(int config_id) {
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());
// Make a copy of this first, before making any changes.
@@ -139,6 +144,8 @@ void StreamParserBuffer::ConvertToSpliceBuffer(
// 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() +