summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-26 21:39:32 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-26 21:39:32 +0000
commit5e0d4de52fcf0ddbcd94a56e6890af4aabf6f705 (patch)
treee485677b0f64cb5268eef6a6a0f5618bcc03b6cc /media/base
parent5c84b7e13f3525b84f7928e946727b5b8b77899b (diff)
downloadchromium_src-5e0d4de52fcf0ddbcd94a56e6890af4aabf6f705.zip
chromium_src-5e0d4de52fcf0ddbcd94a56e6890af4aabf6f705.tar.gz
chromium_src-5e0d4de52fcf0ddbcd94a56e6890af4aabf6f705.tar.bz2
Removed PushSource::Packet. SeekableBuffer.current_time() fixed to return
kInvalidTimestamp when the time is unknown. TEST=media_unittests BUG=28654 Review URL: http://codereview.chromium.org/2140001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r--media/base/seekable_buffer.cc5
-rw-r--r--media/base/seekable_buffer.h6
-rw-r--r--media/base/seekable_buffer_unittest.cc25
3 files changed, 22 insertions, 14 deletions
diff --git a/media/base/seekable_buffer.cc b/media/base/seekable_buffer.cc
index 15819c1..f076ee8 100644
--- a/media/base/seekable_buffer.cc
+++ b/media/base/seekable_buffer.cc
@@ -17,7 +17,8 @@ SeekableBuffer::SeekableBuffer(size_t backward_capacity,
backward_capacity_(backward_capacity),
backward_bytes_(0),
forward_capacity_(forward_capacity),
- forward_bytes_(0) {
+ forward_bytes_(0),
+ current_time_(StreamSample::kInvalidTimestamp) {
current_buffer_ = buffers_.begin();
}
@@ -30,7 +31,7 @@ void SeekableBuffer::Clear() {
current_buffer_offset_ = 0;
backward_bytes_ = 0;
forward_bytes_ = 0;
- current_time_ = base::TimeDelta();
+ current_time_ = StreamSample::kInvalidTimestamp;
}
diff --git a/media/base/seekable_buffer.h b/media/base/seekable_buffer.h
index 1a423e0..eff34e6 100644
--- a/media/base/seekable_buffer.h
+++ b/media/base/seekable_buffer.h
@@ -111,9 +111,9 @@ class SeekableBuffer {
// value calculated based on the timestamp of the current buffer. If
// timestamp for the current buffer is set to 0 or the data was added with
// Append(const uint*, size_t), then returns value that corresponds to the
- // last position in a buffer that had timestamp set. 0 is returned if no
- // buffers we read from had timestamp set.
- // TODO(sergeyu): Use StreamSample::kInvalidTimestamp here.
+ // last position in a buffer that had timestamp set.
+ // StreamSample::kInvalidTimestamp is returned if no buffers we read
+ // from had timestamp set.
base::TimeDelta current_time() const { return current_time_; }
private:
diff --git a/media/base/seekable_buffer_unittest.cc b/media/base/seekable_buffer_unittest.cc
index 72e1933..286580b 100644
--- a/media/base/seekable_buffer_unittest.cc
+++ b/media/base/seekable_buffer_unittest.cc
@@ -291,6 +291,9 @@ TEST_F(SeekableBufferTest, AllMethods) {
TEST_F(SeekableBufferTest, GetTime) {
+ const base::TimeDelta kInvalidTimestamp =
+ media::StreamSample::kInvalidTimestamp;
+
const struct {
int64 first_time_useconds;
int64 duration_useconds;
@@ -298,15 +301,15 @@ TEST_F(SeekableBufferTest, GetTime) {
int64 expected_time;
} tests[] = {
// Timestamps of 0 are treated as garbage.
- { 0, 1000000, 0, 0 },
- { 0, 4000000, 0, 0 },
- { 0, 8000000, 0, 0 },
- { 0, 1000000, 4, 0 },
- { 0, 4000000, 4, 0 },
- { 0, 8000000, 4, 0 },
- { 0, 1000000, kWriteSize, 0 },
- { 0, 4000000, kWriteSize, 0 },
- { 0, 8000000, kWriteSize, 0 },
+ { 0, 1000000, 0, kInvalidTimestamp.ToInternalValue() },
+ { 0, 4000000, 0, kInvalidTimestamp.ToInternalValue() },
+ { 0, 8000000, 0, kInvalidTimestamp.ToInternalValue() },
+ { 0, 1000000, 4, kInvalidTimestamp.ToInternalValue() },
+ { 0, 4000000, 4, kInvalidTimestamp.ToInternalValue() },
+ { 0, 8000000, 4, kInvalidTimestamp.ToInternalValue() },
+ { 0, 1000000, kWriteSize, kInvalidTimestamp.ToInternalValue() },
+ { 0, 4000000, kWriteSize, kInvalidTimestamp.ToInternalValue() },
+ { 0, 8000000, kWriteSize, kInvalidTimestamp.ToInternalValue() },
{ 5, 1000000, 0, 5 },
{ 5, 4000000, 0, 5 },
{ 5, 8000000, 0, 5 },
@@ -318,6 +321,10 @@ TEST_F(SeekableBufferTest, GetTime) {
{ 5, 8000000, kWriteSize, 8000005 },
};
+ // current_time() must initially return kInvalidTimestamp.
+ EXPECT_EQ(kInvalidTimestamp.ToInternalValue(),
+ buffer_.current_time().ToInternalValue());
+
scoped_refptr<media::DataBuffer> buffer = new media::DataBuffer(kWriteSize);
memcpy(buffer->GetWritableData(), data_, kWriteSize);
buffer->SetDataSize(kWriteSize);