summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-27 05:19:10 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-27 05:19:10 +0000
commit2f3baf428b3c207640c60541446a55944226c4b8 (patch)
tree685e0aa870cfead1bd67c74f07858ffb3e08de19
parent7abed830dbe97f1620f25d25867dfcf4b1626670 (diff)
downloadchromium_src-2f3baf428b3c207640c60541446a55944226c4b8.zip
chromium_src-2f3baf428b3c207640c60541446a55944226c4b8.tar.gz
chromium_src-2f3baf428b3c207640c60541446a55944226c4b8.tar.bz2
Replace size_t with int in a few media classes.
This addressed TODOs in DataSource::Read() and AudioRendererAlgorithmBase, which led to converting Buffer and SeekableBuffer as well. Review URL: https://chromiumcodereview.appspot.com/9854031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129140 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--media/audio/linux/alsa_output.cc12
-rw-r--r--media/audio/linux/alsa_output_unittest.cc16
-rw-r--r--media/audio/mac/audio_low_latency_input_mac_unittest.cc8
-rw-r--r--media/audio/win/audio_low_latency_input_win_unittest.cc2
-rw-r--r--media/base/buffers.h2
-rw-r--r--media/base/buffers_unittest.cc8
-rw-r--r--media/base/data_buffer.cc14
-rw-r--r--media/base/data_buffer.h16
-rw-r--r--media/base/data_buffer_unittest.cc8
-rw-r--r--media/base/data_source.cc4
-rw-r--r--media/base/data_source.h9
-rw-r--r--media/base/mock_filters.h2
-rw-r--r--media/base/seekable_buffer.cc54
-rw-r--r--media/base/seekable_buffer.h46
-rw-r--r--media/base/seekable_buffer_unittest.cc92
-rw-r--r--media/crypto/aes_decryptor_unittest.cc2
-rw-r--r--media/filters/audio_renderer_algorithm_base.cc56
-rw-r--r--media/filters/audio_renderer_algorithm_base.h26
-rw-r--r--media/filters/ffmpeg_demuxer.cc18
-rw-r--r--media/filters/ffmpeg_demuxer.h14
-rw-r--r--media/filters/ffmpeg_demuxer_unittest.cc12
-rw-r--r--media/filters/file_data_source.cc4
-rw-r--r--media/filters/file_data_source.h2
-rw-r--r--media/filters/file_data_source_unittest.cc2
-rw-r--r--media/tools/player_x11/data_source_logger.cc6
-rw-r--r--media/tools/player_x11/data_source_logger.h2
-rw-r--r--webkit/media/buffered_data_source.cc7
-rw-r--r--webkit/media/buffered_data_source.h7
-rw-r--r--webkit/media/buffered_data_source_unittest.cc4
-rw-r--r--webkit/media/buffered_resource_loader_unittest.cc30
30 files changed, 234 insertions, 251 deletions
diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc
index 8ba86df6..fc74180 100644
--- a/media/audio/linux/alsa_output.cc
+++ b/media/audio/linux/alsa_output.cc
@@ -373,11 +373,11 @@ void AlsaPcmOutputStream::BufferPacket(bool* source_exhausted) {
scoped_refptr<media::DataBuffer> packet =
new media::DataBuffer(packet_size_);
- size_t packet_size = RunDataCallback(packet->GetWritableData(),
- packet->GetBufferSize(),
- AudioBuffersState(buffer_delay,
- hardware_delay));
- CHECK(packet_size <= packet->GetBufferSize());
+ int packet_size = RunDataCallback(packet->GetWritableData(),
+ packet->GetBufferSize(),
+ AudioBuffersState(buffer_delay,
+ hardware_delay));
+ CHECK_LE(packet_size, packet->GetBufferSize());
// This should not happen, but in case it does, drop any trailing bytes
// that aren't large enough to make a frame. Without this, packet writing
@@ -430,7 +430,7 @@ void AlsaPcmOutputStream::WritePacket() {
CHECK_EQ(buffer_->forward_bytes() % bytes_per_output_frame_, 0u);
const uint8* buffer_data;
- size_t buffer_size;
+ int buffer_size;
if (buffer_->GetCurrentChunk(&buffer_data, &buffer_size)) {
buffer_size = buffer_size - (buffer_size % bytes_per_output_frame_);
snd_pcm_sframes_t frames = buffer_size / bytes_per_output_frame_;
diff --git a/media/audio/linux/alsa_output_unittest.cc b/media/audio/linux/alsa_output_unittest.cc
index adc06e4..ab9a654 100644
--- a/media/audio/linux/alsa_output_unittest.cc
+++ b/media/audio/linux/alsa_output_unittest.cc
@@ -160,7 +160,7 @@ class AlsaPcmOutputStreamTest : public testing::Test {
static const char kTestDeviceName[];
static const char kDummyMessage[];
static const uint32 kTestFramesPerPacket;
- static const uint32 kTestPacketSize;
+ static const int kTestPacketSize;
static const int kTestFailedErrno;
static snd_pcm_t* const kFakeHandle;
@@ -195,7 +195,7 @@ const AudioParameters::Format AlsaPcmOutputStreamTest::kTestFormat =
const char AlsaPcmOutputStreamTest::kTestDeviceName[] = "TestDevice";
const char AlsaPcmOutputStreamTest::kDummyMessage[] = "dummy";
const uint32 AlsaPcmOutputStreamTest::kTestFramesPerPacket = 1000;
-const uint32 AlsaPcmOutputStreamTest::kTestPacketSize =
+const int AlsaPcmOutputStreamTest::kTestPacketSize =
AlsaPcmOutputStreamTest::kTestFramesPerPacket *
AlsaPcmOutputStreamTest::kTestBytesPerFrame;
const int AlsaPcmOutputStreamTest::kTestFailedErrno = -EACCES;
@@ -498,7 +498,7 @@ TEST_F(AlsaPcmOutputStreamTest, WritePacket_NormalPacket) {
_))
.WillOnce(Return(packet_->GetDataSize() / kTestBytesPerFrame - written));
test_stream->WritePacket();
- EXPECT_EQ(0u, test_stream->buffer_->forward_bytes());
+ EXPECT_EQ(0, test_stream->buffer_->forward_bytes());
test_stream->Close();
}
@@ -539,7 +539,7 @@ TEST_F(AlsaPcmOutputStreamTest, WritePacket_StopStream) {
// No expectations set on the strict mock because nothing should be called.
test_stream->stop_stream_ = true;
test_stream->WritePacket();
- EXPECT_EQ(0u, test_stream->buffer_->forward_bytes());
+ EXPECT_EQ(0, test_stream->buffer_->forward_bytes());
test_stream->Close();
}
@@ -566,7 +566,7 @@ TEST_F(AlsaPcmOutputStreamTest, BufferPacket) {
test_stream->packet_size_ = kTestPacketSize;
test_stream->BufferPacket(&source_exhausted);
- EXPECT_EQ(10u, test_stream->buffer_->forward_bytes());
+ EXPECT_EQ(10, test_stream->buffer_->forward_bytes());
EXPECT_FALSE(source_exhausted);
test_stream->Close();
}
@@ -592,7 +592,7 @@ TEST_F(AlsaPcmOutputStreamTest, BufferPacket_Negative) {
test_stream->packet_size_ = kTestPacketSize;
test_stream->BufferPacket(&source_exhausted);
- EXPECT_EQ(10u, test_stream->buffer_->forward_bytes());
+ EXPECT_EQ(10, test_stream->buffer_->forward_bytes());
EXPECT_FALSE(source_exhausted);
test_stream->Close();
}
@@ -619,7 +619,7 @@ TEST_F(AlsaPcmOutputStreamTest, BufferPacket_Underrun) {
test_stream->packet_size_ = kTestPacketSize;
test_stream->BufferPacket(&source_exhausted);
- EXPECT_EQ(10u, test_stream->buffer_->forward_bytes());
+ EXPECT_EQ(10, test_stream->buffer_->forward_bytes());
EXPECT_FALSE(source_exhausted);
test_stream->Close();
}
@@ -777,7 +777,7 @@ TEST_F(AlsaPcmOutputStreamTest, BufferPacket_StopStream) {
test_stream->stop_stream_ = true;
bool source_exhausted;
test_stream->BufferPacket(&source_exhausted);
- EXPECT_EQ(0u, test_stream->buffer_->forward_bytes());
+ EXPECT_EQ(0, test_stream->buffer_->forward_bytes());
EXPECT_TRUE(source_exhausted);
test_stream->Close();
}
diff --git a/media/audio/mac/audio_low_latency_input_mac_unittest.cc b/media/audio/mac/audio_low_latency_input_mac_unittest.cc
index 6a01a3b..a4619c3 100644
--- a/media/audio/mac/audio_low_latency_input_mac_unittest.cc
+++ b/media/audio/mac/audio_low_latency_input_mac_unittest.cc
@@ -44,7 +44,7 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback {
public:
// Allocate space for ~10 seconds of data @ 48kHz in stereo:
// 2 bytes per sample, 2 channels, 10ms @ 48kHz, 10 seconds <=> 1920000 bytes.
- static const size_t kMaxBufferSize = 2 * 2 * 480 * 100 * 10;
+ static const int kMaxBufferSize = 2 * 2 * 480 * 100 * 10;
explicit WriteToFileAudioSink(const char* file_name)
: buffer_(0, kMaxBufferSize),
@@ -53,10 +53,10 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback {
}
virtual ~WriteToFileAudioSink() {
- size_t bytes_written = 0;
+ int bytes_written = 0;
while (bytes_written < bytes_to_write_) {
const uint8* chunk;
- size_t chunk_size;
+ int chunk_size;
// Stop writing if no more data is available.
if (!buffer_.GetCurrentChunk(&chunk, &chunk_size))
@@ -88,7 +88,7 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback {
private:
media::SeekableBuffer buffer_;
FILE* file_;
- size_t bytes_to_write_;
+ int bytes_to_write_;
};
class MacAudioInputTest : public testing::Test {
diff --git a/media/audio/win/audio_low_latency_input_win_unittest.cc b/media/audio/win/audio_low_latency_input_win_unittest.cc
index 11554c7..8afa95c 100644
--- a/media/audio/win/audio_low_latency_input_win_unittest.cc
+++ b/media/audio/win/audio_low_latency_input_win_unittest.cc
@@ -65,7 +65,7 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback {
size_t bytes_written = 0;
while (bytes_written < bytes_to_write_) {
const uint8* chunk;
- size_t chunk_size;
+ int chunk_size;
// Stop writing if no more data is available.
if (!buffer_.GetCurrentChunk(&chunk, &chunk_size))
diff --git a/media/base/buffers.h b/media/base/buffers.h
index 2013a4a..f4e4264 100644
--- a/media/base/buffers.h
+++ b/media/base/buffers.h
@@ -51,7 +51,7 @@ class MEDIA_EXPORT Buffer : public base::RefCountedThreadSafe<Buffer> {
virtual const uint8* GetData() const = 0;
// Returns the size of valid data in bytes.
- virtual size_t GetDataSize() const = 0;
+ virtual int GetDataSize() const = 0;
// If there's no data in this buffer, it represents end of stream.
bool IsEndOfStream() const;
diff --git a/media/base/buffers_unittest.cc b/media/base/buffers_unittest.cc
index 9107bbd..206f4f0 100644
--- a/media/base/buffers_unittest.cc
+++ b/media/base/buffers_unittest.cc
@@ -19,7 +19,7 @@ class TestBuffer : public Buffer {
// Sets |data_| and |size_| members for testing purposes. Does not take
// ownership of |data|.
- TestBuffer(const uint8* data, size_t size)
+ TestBuffer(const uint8* data, int size)
: Buffer(base::TimeDelta(), base::TimeDelta()),
data_(data),
size_(size) {
@@ -29,11 +29,11 @@ class TestBuffer : public Buffer {
// Buffer implementation.
virtual const uint8* GetData() const OVERRIDE { return data_; }
- virtual size_t GetDataSize() const OVERRIDE { return size_; }
+ virtual int GetDataSize() const OVERRIDE { return size_; }
private:
const uint8* data_;
- size_t size_;
+ int size_;
DISALLOW_COPY_AND_ASSIGN(TestBuffer);
};
@@ -72,7 +72,7 @@ TEST(BufferTest, Duration) {
TEST(BufferTest, IsEndOfStream) {
const uint8 kData[] = { 0x00, 0xFF };
- const size_t kDataSize = arraysize(kData);
+ const int kDataSize = arraysize(kData);
scoped_refptr<TestBuffer> buffer = new TestBuffer(NULL, 0);
EXPECT_TRUE(buffer->IsEndOfStream());
diff --git a/media/base/data_buffer.cc b/media/base/data_buffer.cc
index 8faa12b..b082a18 100644
--- a/media/base/data_buffer.cc
+++ b/media/base/data_buffer.cc
@@ -11,14 +11,14 @@
namespace media {
-DataBuffer::DataBuffer(scoped_array<uint8> buffer, size_t buffer_size)
+DataBuffer::DataBuffer(scoped_array<uint8> buffer, int buffer_size)
: Buffer(base::TimeDelta(), base::TimeDelta()),
data_(buffer.Pass()),
buffer_size_(buffer_size),
data_size_(buffer_size) {
}
-DataBuffer::DataBuffer(size_t buffer_size)
+DataBuffer::DataBuffer(int buffer_size)
: Buffer(base::TimeDelta(), base::TimeDelta()),
data_(new uint8[buffer_size]),
buffer_size_(buffer_size),
@@ -33,8 +33,8 @@ DataBuffer::DataBuffer(size_t buffer_size)
DataBuffer::~DataBuffer() {}
scoped_refptr<DataBuffer> DataBuffer::CopyFrom(const uint8* data,
- size_t data_size) {
- size_t padding_size = 0;
+ int data_size) {
+ int padding_size = 0;
#if !defined(OS_ANDROID)
// Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
// padded with this value.
@@ -53,7 +53,7 @@ const uint8* DataBuffer::GetData() const {
return data_.get();
}
-size_t DataBuffer::GetDataSize() const {
+int DataBuffer::GetDataSize() const {
return data_size_;
}
@@ -66,12 +66,12 @@ uint8* DataBuffer::GetWritableData() {
}
-void DataBuffer::SetDataSize(size_t data_size) {
+void DataBuffer::SetDataSize(int data_size) {
DCHECK_LE(data_size, buffer_size_);
data_size_ = data_size;
}
-size_t DataBuffer::GetBufferSize() const {
+int DataBuffer::GetBufferSize() const {
return buffer_size_;
}
diff --git a/media/base/data_buffer.h b/media/base/data_buffer.h
index 651088f..15ef32d 100644
--- a/media/base/data_buffer.h
+++ b/media/base/data_buffer.h
@@ -18,18 +18,18 @@ namespace media {
class MEDIA_EXPORT DataBuffer : public Buffer {
public:
// Assumes valid data of size |buffer_size|.
- DataBuffer(scoped_array<uint8> buffer, size_t buffer_size);
+ DataBuffer(scoped_array<uint8> buffer, int buffer_size);
// Allocates buffer of size |buffer_size|. If |buffer_size| is 0, |data_| is
// set to a NULL ptr.
- explicit DataBuffer(size_t buffer_size);
+ explicit DataBuffer(int buffer_size);
// Create a DataBuffer whose |data_| is copied from |data|.
- static scoped_refptr<DataBuffer> CopyFrom(const uint8* data, size_t size);
+ static scoped_refptr<DataBuffer> CopyFrom(const uint8* data, int size);
// Buffer implementation.
virtual const uint8* GetData() const OVERRIDE;
- virtual size_t GetDataSize() const OVERRIDE;
+ virtual int GetDataSize() const OVERRIDE;
virtual const DecryptConfig* GetDecryptConfig() const OVERRIDE;
// Returns a read-write pointer to the buffer data.
@@ -37,10 +37,10 @@ class MEDIA_EXPORT DataBuffer : public Buffer {
// Updates the size of valid data in bytes, which must be less than or equal
// to GetBufferSize().
- virtual void SetDataSize(size_t data_size);
+ virtual void SetDataSize(int data_size);
// Returns the size of the underlying buffer.
- virtual size_t GetBufferSize() const;
+ virtual int GetBufferSize() const;
virtual void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config);
@@ -49,8 +49,8 @@ class MEDIA_EXPORT DataBuffer : public Buffer {
private:
scoped_array<uint8> data_;
- size_t buffer_size_;
- size_t data_size_;
+ int buffer_size_;
+ int data_size_;
scoped_ptr<DecryptConfig> decrypt_config_;
DISALLOW_COPY_AND_ASSIGN(DataBuffer);
diff --git a/media/base/data_buffer_unittest.cc b/media/base/data_buffer_unittest.cc
index 38b73d9..d685a87 100644
--- a/media/base/data_buffer_unittest.cc
+++ b/media/base/data_buffer_unittest.cc
@@ -9,21 +9,21 @@
namespace media {
TEST(DataBufferTest, Constructors) {
- const size_t kTestSize = 10;
+ const int kTestSize = 10;
scoped_refptr<DataBuffer> buffer(new DataBuffer(0));
EXPECT_FALSE(buffer->GetData());
scoped_refptr<DataBuffer> buffer2(new DataBuffer(kTestSize));
- EXPECT_EQ(0u, buffer2->GetDataSize());
+ EXPECT_EQ(0, buffer2->GetDataSize());
EXPECT_EQ(kTestSize, buffer2->GetBufferSize());
}
TEST(DataBufferTest, ReadingWriting) {
const char kData[] = "hello";
- const size_t kDataSize = arraysize(kData);
+ const int kDataSize = arraysize(kData);
const char kNewData[] = "chromium";
- const size_t kNewDataSize = arraysize(kNewData);
+ const int kNewDataSize = arraysize(kNewData);
// Create a DataBuffer.
scoped_refptr<DataBuffer> buffer(new DataBuffer(kDataSize));
diff --git a/media/base/data_source.cc b/media/base/data_source.cc
index f310af8..c25f9e7 100644
--- a/media/base/data_source.cc
+++ b/media/base/data_source.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,7 @@
namespace media {
// static
-const size_t DataSource::kReadError = static_cast<size_t>(-1);
+const int DataSource::kReadError = -1;
DataSourceHost::~DataSourceHost() {}
diff --git a/media/base/data_source.h b/media/base/data_source.h
index 7577237..2c7e808 100644
--- a/media/base/data_source.h
+++ b/media/base/data_source.h
@@ -30,8 +30,8 @@ class MEDIA_EXPORT DataSourceHost {
class MEDIA_EXPORT DataSource : public base::RefCountedThreadSafe<DataSource> {
public:
typedef base::Callback<void(int64, int64)> StatusCallback;
- typedef base::Callback<void(size_t)> ReadCB;
- static const size_t kReadError;
+ typedef base::Callback<void(int)> ReadCB;
+ static const int kReadError;
DataSource();
@@ -40,10 +40,7 @@ class MEDIA_EXPORT DataSource : public base::RefCountedThreadSafe<DataSource> {
// Reads |size| bytes from |position| into |data|. And when the read is done
// or failed, |read_cb| is called with the number of bytes read or
// kReadError in case of error.
- // TODO(hclam): should change |size| to int! It makes the code so messy
- // with size_t and int all over the place..
- virtual void Read(int64 position, size_t size,
- uint8* data,
+ virtual void Read(int64 position, int size, uint8* data,
const DataSource::ReadCB& read_cb) = 0;
// Notifies the DataSource of a change in the current playback rate.
diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h
index 152619d..4c18796 100644
--- a/media/base/mock_filters.h
+++ b/media/base/mock_filters.h
@@ -81,7 +81,7 @@ class MockDataSource : public DataSource {
MOCK_METHOD0(OnAudioRendererDisabled, void());
// DataSource implementation.
- MOCK_METHOD4(Read, void(int64 position, size_t size, uint8* data,
+ MOCK_METHOD4(Read, void(int64 position, int size, uint8* data,
const DataSource::ReadCB& callback));
MOCK_METHOD1(GetSize, bool(int64* size_out));
MOCK_METHOD1(SetPreload, void(Preload preload));
diff --git a/media/base/seekable_buffer.cc b/media/base/seekable_buffer.cc
index 49df43f..b88153a 100644
--- a/media/base/seekable_buffer.cc
+++ b/media/base/seekable_buffer.cc
@@ -11,8 +11,8 @@
namespace media {
-SeekableBuffer::SeekableBuffer(size_t backward_capacity,
- size_t forward_capacity)
+SeekableBuffer::SeekableBuffer(int backward_capacity,
+ int forward_capacity)
: current_buffer_offset_(0),
backward_capacity_(backward_capacity),
backward_bytes_(0),
@@ -34,19 +34,19 @@ void SeekableBuffer::Clear() {
current_time_ = kNoTimestamp();
}
-size_t SeekableBuffer::Read(uint8* data, size_t size) {
+int SeekableBuffer::Read(uint8* data, int size) {
DCHECK(data);
return InternalRead(data, size, true, 0);
}
-size_t SeekableBuffer::Peek(uint8* data, size_t size, size_t forward_offset) {
+int SeekableBuffer::Peek(uint8* data, int size, int forward_offset) {
DCHECK(data);
return InternalRead(data, size, false, forward_offset);
}
-bool SeekableBuffer::GetCurrentChunk(const uint8** data, size_t* size) const {
+bool SeekableBuffer::GetCurrentChunk(const uint8** data, int* size) const {
BufferQueue::iterator current_buffer = current_buffer_;
- size_t current_buffer_offset = current_buffer_offset_;
+ int current_buffer_offset = current_buffer_offset_;
// Advance position if we are in the end of the current buffer.
while (current_buffer != buffers_.end() &&
current_buffer_offset >= (*current_buffer)->GetDataSize()) {
@@ -72,7 +72,7 @@ bool SeekableBuffer::Append(Buffer* buffer_in) {
// After we have written the first buffer, update |current_buffer_| to point
// to it.
if (current_buffer_ == buffers_.end()) {
- DCHECK_EQ(0u, forward_bytes_);
+ DCHECK_EQ(0, forward_bytes_);
current_buffer_ = buffers_.begin();
}
@@ -87,7 +87,7 @@ bool SeekableBuffer::Append(Buffer* buffer_in) {
return true;
}
-bool SeekableBuffer::Append(const uint8* data, size_t size) {
+bool SeekableBuffer::Append(const uint8* data, int size) {
if (size > 0) {
DataBuffer* data_buffer = new DataBuffer(size);
memcpy(data_buffer->GetWritableData(), data, size);
@@ -107,22 +107,22 @@ bool SeekableBuffer::Seek(int32 offset) {
return true;
}
-bool SeekableBuffer::SeekForward(size_t size) {
+bool SeekableBuffer::SeekForward(int size) {
// Perform seeking forward only if we have enough bytes in the queue.
if (size > forward_bytes_)
return false;
// Do a read of |size| bytes.
- size_t taken = InternalRead(NULL, size, true, 0);
+ int taken = InternalRead(NULL, size, true, 0);
DCHECK_EQ(taken, size);
return true;
}
-bool SeekableBuffer::SeekBackward(size_t size) {
+bool SeekableBuffer::SeekBackward(int size) {
if (size > backward_bytes_)
return false;
// Record the number of bytes taken.
- size_t taken = 0;
+ int taken = 0;
// Loop until we taken enough bytes and rewind by the desired |size|.
while (taken < size) {
// |current_buffer_| can never be invalid when we are in this loop. It can
@@ -134,7 +134,7 @@ bool SeekableBuffer::SeekBackward(size_t size) {
// have to account for the offset we are in the current buffer, so take the
// minimum between the two to determine the amount of bytes to take from the
// current buffer.
- size_t consumed = std::min(size - taken, current_buffer_offset_);
+ int consumed = std::min(size - taken, current_buffer_offset_);
// Decreases the offset in the current buffer since we are rewinding.
current_buffer_offset_ -= consumed;
@@ -147,7 +147,7 @@ bool SeekableBuffer::SeekBackward(size_t size) {
// consumed in the current buffer.
forward_bytes_ += consumed;
backward_bytes_ -= consumed;
- DCHECK_GE(backward_bytes_, 0u);
+ DCHECK_GE(backward_bytes_, 0);
// The current buffer pointed by current iterator has been consumed. Move
// the iterator backward so it points to the previous buffer.
@@ -176,22 +176,22 @@ void SeekableBuffer::EvictBackwardBuffers() {
break;
scoped_refptr<Buffer> buffer = *i;
backward_bytes_ -= buffer->GetDataSize();
- DCHECK_GE(backward_bytes_, 0u);
+ DCHECK_GE(backward_bytes_, 0);
buffers_.erase(i);
}
}
-size_t SeekableBuffer::InternalRead(uint8* data, size_t size,
- bool advance_position,
- size_t forward_offset) {
+int SeekableBuffer::InternalRead(uint8* data, int size,
+ bool advance_position,
+ int forward_offset) {
// Counts how many bytes are actually read from the buffer queue.
- size_t taken = 0;
+ int taken = 0;
BufferQueue::iterator current_buffer = current_buffer_;
- size_t current_buffer_offset = current_buffer_offset_;
+ int current_buffer_offset = current_buffer_offset_;
- size_t bytes_to_skip = forward_offset;
+ int bytes_to_skip = forward_offset;
while (taken < size) {
// |current_buffer| is valid since the first time this buffer is appended
// with data.
@@ -200,14 +200,14 @@ size_t SeekableBuffer::InternalRead(uint8* data, size_t size,
scoped_refptr<Buffer> buffer = *current_buffer;
- size_t remaining_bytes_in_buffer =
+ int remaining_bytes_in_buffer =
buffer->GetDataSize() - current_buffer_offset;
if (bytes_to_skip == 0) {
// Find the right amount to copy from the current buffer referenced by
// |buffer|. We shall copy no more than |size| bytes in total and each
// single step copied no more than the current buffer size.
- size_t copied = std::min(size - taken, remaining_bytes_in_buffer);
+ int copied = std::min(size - taken, remaining_bytes_in_buffer);
// |data| is NULL if we are seeking forward, so there's no need to copy.
if (data)
@@ -221,7 +221,7 @@ size_t SeekableBuffer::InternalRead(uint8* data, size_t size,
// offset.
current_buffer_offset += copied;
} else {
- size_t skipped = std::min(remaining_bytes_in_buffer, bytes_to_skip);
+ int skipped = std::min(remaining_bytes_in_buffer, bytes_to_skip);
current_buffer_offset += skipped;
bytes_to_skip -= skipped;
}
@@ -251,8 +251,8 @@ size_t SeekableBuffer::InternalRead(uint8* data, size_t size,
// counters by |taken|.
forward_bytes_ -= taken;
backward_bytes_ += taken;
- DCHECK_GE(forward_bytes_, 0u);
- DCHECK(current_buffer_ != buffers_.end() || forward_bytes_ == 0u);
+ DCHECK_GE(forward_bytes_, 0);
+ DCHECK(current_buffer_ != buffers_.end() || forward_bytes_ == 0);
current_buffer_ = current_buffer;
current_buffer_offset_ = current_buffer_offset;
@@ -265,7 +265,7 @@ size_t SeekableBuffer::InternalRead(uint8* data, size_t size,
}
void SeekableBuffer::UpdateCurrentTime(BufferQueue::iterator buffer,
- size_t offset) {
+ int offset) {
// Garbage values are unavoidable, so this check will remain.
if (buffer != buffers_.end() &&
(*buffer)->GetTimestamp().InMicroseconds() > 0) {
diff --git a/media/base/seekable_buffer.h b/media/base/seekable_buffer.h
index eb7ba84..0a3ff72 100644
--- a/media/base/seekable_buffer.h
+++ b/media/base/seekable_buffer.h
@@ -45,7 +45,7 @@ class MEDIA_EXPORT SeekableBuffer {
public:
// Constructs an instance with |forward_capacity| and |backward_capacity|.
// The values are in bytes.
- SeekableBuffer(size_t backward_capacity, size_t forward_capacity);
+ SeekableBuffer(int backward_capacity, int forward_capacity);
~SeekableBuffer();
@@ -57,20 +57,20 @@ class MEDIA_EXPORT SeekableBuffer {
// The current read position will advance by the amount of bytes read. If
// reading caused backward_bytes() to exceed backward_capacity(), an eviction
// of the backward buffer will be done internally.
- size_t Read(uint8* data, size_t size);
+ int Read(uint8* data, int size);
// Copies up to |size| bytes from current position to |data|. Returns
// number of bytes copied. Doesn't advance current position. Optionally
// starts at a |forward_offset| from current position.
- size_t Peek(uint8* data, size_t size) { return Peek(data, size, 0); }
- size_t Peek(uint8* data, size_t size, size_t forward_offset);
+ int Peek(uint8* data, int size) { return Peek(data, size, 0); }
+ int Peek(uint8* data, int size, int forward_offset);
// Returns pointer to the current chunk of data that is being consumed.
// If there is no data left in the buffer false is returned, otherwise
// true is returned and |data| and |size| are updated. The returned
// |data| value becomes invalid when Read(), Append() or Seek()
// are called.
- bool GetCurrentChunk(const uint8** data, size_t* size) const;
+ bool GetCurrentChunk(const uint8** data, int* size) const;
// Appends |buffer_in| to this buffer. Returns false if forward_bytes() is
// greater than or equals to forward_capacity(), true otherwise. The data
@@ -79,7 +79,7 @@ class MEDIA_EXPORT SeekableBuffer {
// Appends |size| bytes of |data| to the buffer. Result is the same
// as for Append(Buffer*).
- bool Append(const uint8* data, size_t size);
+ bool Append(const uint8* data, int size);
// Moves the read position by |offset| bytes. If |offset| is positive, the
// current read position is moved forward. If negative, the current read
@@ -94,34 +94,34 @@ class MEDIA_EXPORT SeekableBuffer {
bool Seek(int32 offset);
// Returns the number of bytes buffered beyond the current read position.
- size_t forward_bytes() const { return forward_bytes_; }
+ int forward_bytes() const { return forward_bytes_; }
// Returns the number of bytes buffered that precedes the current read
// position.
- size_t backward_bytes() const { return backward_bytes_; }
+ int backward_bytes() const { return backward_bytes_; }
// Sets the forward_capacity to |new_forward_capacity| bytes.
- void set_forward_capacity(size_t new_forward_capacity) {
+ void set_forward_capacity(int new_forward_capacity) {
forward_capacity_ = new_forward_capacity;
}
// Sets the backward_capacity to |new_backward_capacity| bytes.
- void set_backward_capacity(size_t new_backward_capacity) {
+ void set_backward_capacity(int new_backward_capacity) {
backward_capacity_ = new_backward_capacity;
}
// Returns the maximum number of bytes that should be kept in the forward
// direction.
- size_t forward_capacity() const { return forward_capacity_; }
+ int forward_capacity() const { return forward_capacity_; }
// Returns the maximum number of bytes that should be kept in the backward
// direction.
- size_t backward_capacity() const { return backward_capacity_; }
+ int backward_capacity() const { return backward_capacity_; }
// Returns the current timestamp, taking into account current offset. The
// 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
+ // Append(const uint*, int), then returns value that corresponds to the
// last position in a buffer that had timestamp set.
// kNoTimestamp() is returned if no buffers we read from had timestamp set.
base::TimeDelta current_time() const { return current_time_; }
@@ -139,36 +139,36 @@ class MEDIA_EXPORT SeekableBuffer {
// of bytes read. The current read position will be moved forward by the
// number of bytes read. If |data| is NULL, only the current read position
// will advance but no data will be copied.
- size_t InternalRead(
- uint8* data, size_t size, bool advance_position, size_t forward_offset);
+ int InternalRead(
+ uint8* data, int size, bool advance_position, int forward_offset);
// A helper method that moves the current read position forward by |size|
// bytes.
// If the return value is true, the operation completed successfully.
// If the return value is false, |size| is greater than forward_bytes() and
// the seek operation failed. The current read position is not updated.
- bool SeekForward(size_t size);
+ bool SeekForward(int size);
// A helper method that moves the current read position backward by |size|
// bytes.
// If the return value is true, the operation completed successfully.
// If the return value is false, |size| is greater than backward_bytes() and
// the seek operation failed. The current read position is not updated.
- bool SeekBackward(size_t size);
+ bool SeekBackward(int size);
// Updates |current_time_| with the time that corresponds to the
// specified position in the buffer.
- void UpdateCurrentTime(BufferQueue::iterator buffer, size_t offset);
+ void UpdateCurrentTime(BufferQueue::iterator buffer, int offset);
BufferQueue::iterator current_buffer_;
BufferQueue buffers_;
- size_t current_buffer_offset_;
+ int current_buffer_offset_;
- size_t backward_capacity_;
- size_t backward_bytes_;
+ int backward_capacity_;
+ int backward_bytes_;
- size_t forward_capacity_;
- size_t forward_bytes_;
+ int forward_capacity_;
+ int forward_bytes_;
// Keeps track of the most recent time we've seen in case the |buffers_| is
// empty when our owner asks what time it is.
diff --git a/media/base/seekable_buffer_unittest.cc b/media/base/seekable_buffer_unittest.cc
index 2cb547f..8d2e1dc 100644
--- a/media/base/seekable_buffer_unittest.cc
+++ b/media/base/seekable_buffer_unittest.cc
@@ -17,22 +17,22 @@ class SeekableBufferTest : public testing::Test {
}
protected:
- static const size_t kDataSize = 409600;
- static const size_t kBufferSize = 4096;
- static const size_t kWriteSize = 512;
+ static const int kDataSize = 409600;
+ static const int kBufferSize = 4096;
+ static const int kWriteSize = 512;
virtual void SetUp() {
// Setup seed.
- size_t seed = static_cast<int32>(base::Time::Now().ToInternalValue());
+ int seed = static_cast<int32>(base::Time::Now().ToInternalValue());
srand(seed);
VLOG(1) << "Random seed: " << seed;
// Creates a test data.
- for (size_t i = 0; i < kDataSize; i++)
+ for (int i = 0; i < kDataSize; i++)
data_[i] = static_cast<char>(rand());
}
- size_t GetRandomInt(size_t maximum) {
+ int GetRandomInt(int maximum) {
return rand() % maximum + 1;
}
@@ -42,11 +42,11 @@ class SeekableBufferTest : public testing::Test {
};
TEST_F(SeekableBufferTest, RandomReadWrite) {
- size_t write_position = 0;
- size_t read_position = 0;
+ int write_position = 0;
+ int read_position = 0;
while (read_position < kDataSize) {
// Write a random amount of data.
- size_t write_size = GetRandomInt(kBufferSize);
+ int write_size = GetRandomInt(kBufferSize);
write_size = std::min(write_size, kDataSize - write_position);
bool should_append = buffer_.Append(data_ + write_position, write_size);
write_position += write_size;
@@ -56,14 +56,14 @@ TEST_F(SeekableBufferTest, RandomReadWrite) {
<< "Incorrect buffer full reported";
// Peek a random amount of data.
- size_t copy_size = GetRandomInt(kBufferSize);
- size_t bytes_copied = buffer_.Peek(write_buffer_, copy_size);
+ int copy_size = GetRandomInt(kBufferSize);
+ int bytes_copied = buffer_.Peek(write_buffer_, copy_size);
EXPECT_GE(copy_size, bytes_copied);
EXPECT_EQ(0, memcmp(write_buffer_, data_ + read_position, bytes_copied));
// Read a random amount of data.
- size_t read_size = GetRandomInt(kBufferSize);
- size_t bytes_read = buffer_.Read(write_buffer_, read_size);
+ int read_size = GetRandomInt(kBufferSize);
+ int bytes_read = buffer_.Read(write_buffer_, read_size);
EXPECT_GE(read_size, bytes_read);
EXPECT_EQ(0, memcmp(write_buffer_, data_ + read_position, bytes_read));
read_position += bytes_read;
@@ -73,11 +73,11 @@ TEST_F(SeekableBufferTest, RandomReadWrite) {
}
TEST_F(SeekableBufferTest, ReadWriteSeek) {
- const size_t kReadSize = kWriteSize / 4;
+ const int kReadSize = kWriteSize / 4;
for (int i = 0; i < 10; ++i) {
// Write until buffer is full.
- for (size_t j = 0; j < kBufferSize; j += kWriteSize) {
+ for (int j = 0; j < kBufferSize; j += kWriteSize) {
bool should_append = buffer_.Append(data_ + j, kWriteSize);
EXPECT_EQ(j < kBufferSize - kWriteSize, should_append)
<< "Incorrect buffer full reported";
@@ -86,9 +86,9 @@ TEST_F(SeekableBufferTest, ReadWriteSeek) {
// Simulate a read and seek pattern. Each loop reads 4 times, each time
// reading a quarter of |kWriteSize|.
- size_t read_position = 0;
- size_t forward_bytes = kBufferSize;
- for (size_t j = 0; j < kBufferSize; j += kWriteSize) {
+ int read_position = 0;
+ int forward_bytes = kBufferSize;
+ for (int j = 0; j < kBufferSize; j += kWriteSize) {
// Read.
EXPECT_EQ(kReadSize, buffer_.Read(write_buffer_, kReadSize));
forward_bytes -= kReadSize;
@@ -154,28 +154,28 @@ TEST_F(SeekableBufferTest, ReadWriteSeek) {
}
TEST_F(SeekableBufferTest, BufferFull) {
- const size_t kMaxWriteSize = 2 * kBufferSize;
+ const int kMaxWriteSize = 2 * kBufferSize;
// Write and expect the buffer to be not full.
- for (size_t i = 0; i < kBufferSize - kWriteSize; i += kWriteSize) {
+ for (int i = 0; i < kBufferSize - kWriteSize; i += kWriteSize) {
EXPECT_TRUE(buffer_.Append(data_ + i, kWriteSize));
EXPECT_EQ(i + kWriteSize, buffer_.forward_bytes());
}
// Write until we have kMaxWriteSize bytes in the buffer. Buffer is full in
// these writes.
- for (size_t i = buffer_.forward_bytes(); i < kMaxWriteSize; i += kWriteSize) {
+ for (int i = buffer_.forward_bytes(); i < kMaxWriteSize; i += kWriteSize) {
EXPECT_FALSE(buffer_.Append(data_ + i, kWriteSize));
EXPECT_EQ(i + kWriteSize, buffer_.forward_bytes());
}
// Read until the buffer is empty.
- size_t read_position = 0;
+ int read_position = 0;
while (buffer_.forward_bytes()) {
// Read a random amount of data.
- size_t read_size = GetRandomInt(kBufferSize);
- size_t forward_bytes = buffer_.forward_bytes();
- size_t bytes_read = buffer_.Read(write_buffer_, read_size);
+ int read_size = GetRandomInt(kBufferSize);
+ int forward_bytes = buffer_.forward_bytes();
+ int bytes_read = buffer_.Read(write_buffer_, read_size);
EXPECT_EQ(0, memcmp(write_buffer_, data_ + read_position, bytes_read));
if (read_size > forward_bytes)
EXPECT_EQ(forward_bytes, bytes_read);
@@ -187,26 +187,26 @@ TEST_F(SeekableBufferTest, BufferFull) {
}
// Expects we have no bytes left.
- EXPECT_EQ(0u, buffer_.forward_bytes());
- EXPECT_EQ(0u, buffer_.Read(write_buffer_, 1));
+ EXPECT_EQ(0, buffer_.forward_bytes());
+ EXPECT_EQ(0, buffer_.Read(write_buffer_, 1));
}
TEST_F(SeekableBufferTest, SeekBackward) {
- EXPECT_EQ(0u, buffer_.forward_bytes());
- EXPECT_EQ(0u, buffer_.backward_bytes());
+ EXPECT_EQ(0, buffer_.forward_bytes());
+ EXPECT_EQ(0, buffer_.backward_bytes());
EXPECT_FALSE(buffer_.Seek(1));
EXPECT_FALSE(buffer_.Seek(-1));
- const size_t kReadSize = 256;
+ const int kReadSize = 256;
// Write into buffer until it's full.
- for (size_t i = 0; i < kBufferSize; i += kWriteSize) {
+ for (int i = 0; i < kBufferSize; i += kWriteSize) {
// Write a random amount of data.
buffer_.Append(data_ + i, kWriteSize);
}
// Read until buffer is empty.
- for (size_t i = 0; i < kBufferSize; i += kReadSize) {
+ for (int i = 0; i < kBufferSize; i += kReadSize) {
EXPECT_EQ(kReadSize, buffer_.Read(write_buffer_, kReadSize));
EXPECT_EQ(0, memcmp(write_buffer_, data_ + i, kReadSize));
}
@@ -216,21 +216,21 @@ TEST_F(SeekableBufferTest, SeekBackward) {
EXPECT_FALSE(buffer_.Seek(-1));
// Read again.
- for (size_t i = 0; i < kBufferSize; i += kReadSize) {
+ for (int i = 0; i < kBufferSize; i += kReadSize) {
EXPECT_EQ(kReadSize, buffer_.Read(write_buffer_, kReadSize));
EXPECT_EQ(0, memcmp(write_buffer_, data_ + i, kReadSize));
}
}
TEST_F(SeekableBufferTest, GetCurrentChunk) {
- const size_t kSeekSize = kWriteSize / 3;
+ const int kSeekSize = kWriteSize / 3;
scoped_refptr<media::DataBuffer> buffer(new media::DataBuffer(kWriteSize));
memcpy(buffer->GetWritableData(), data_, kWriteSize);
buffer->SetDataSize(kWriteSize);
const uint8* data;
- size_t size;
+ int size;
EXPECT_FALSE(buffer_.GetCurrentChunk(&data, &size));
buffer_.Append(buffer.get());
@@ -245,12 +245,12 @@ TEST_F(SeekableBufferTest, GetCurrentChunk) {
}
TEST_F(SeekableBufferTest, SeekForward) {
- size_t write_position = 0;
- size_t read_position = 0;
+ int write_position = 0;
+ int read_position = 0;
while (read_position < kDataSize) {
for (int i = 0; i < 10 && write_position < kDataSize; ++i) {
// Write a random amount of data.
- size_t write_size = GetRandomInt(kBufferSize);
+ int write_size = GetRandomInt(kBufferSize);
write_size = std::min(write_size, kDataSize - write_position);
bool should_append = buffer_.Append(data_ + write_position, write_size);
@@ -262,15 +262,15 @@ TEST_F(SeekableBufferTest, SeekForward) {
}
// Read a random amount of data.
- size_t seek_size = GetRandomInt(kBufferSize);
+ int seek_size = GetRandomInt(kBufferSize);
if (buffer_.Seek(seek_size))
read_position += seek_size;
EXPECT_GE(write_position, read_position);
EXPECT_EQ(write_position - read_position, buffer_.forward_bytes());
// Read a random amount of data.
- size_t read_size = GetRandomInt(kBufferSize);
- size_t bytes_read = buffer_.Read(write_buffer_, read_size);
+ int read_size = GetRandomInt(kBufferSize);
+ int bytes_read = buffer_.Read(write_buffer_, read_size);
EXPECT_GE(read_size, bytes_read);
EXPECT_EQ(0, memcmp(write_buffer_, data_ + read_position, bytes_read));
read_position += bytes_read;
@@ -280,13 +280,13 @@ TEST_F(SeekableBufferTest, SeekForward) {
}
TEST_F(SeekableBufferTest, AllMethods) {
- EXPECT_EQ(0u, buffer_.Read(write_buffer_, 0));
- EXPECT_EQ(0u, buffer_.Read(write_buffer_, 1));
+ EXPECT_EQ(0, buffer_.Read(write_buffer_, 0));
+ EXPECT_EQ(0, buffer_.Read(write_buffer_, 1));
EXPECT_TRUE(buffer_.Seek(0));
EXPECT_FALSE(buffer_.Seek(-1));
EXPECT_FALSE(buffer_.Seek(1));
- EXPECT_EQ(0u, buffer_.forward_bytes());
- EXPECT_EQ(0u, buffer_.backward_bytes());
+ EXPECT_EQ(0, buffer_.forward_bytes());
+ EXPECT_EQ(0, buffer_.backward_bytes());
}
@@ -294,7 +294,7 @@ TEST_F(SeekableBufferTest, GetTime) {
const struct {
int64 first_time_useconds;
int64 duration_useconds;
- size_t consume_bytes;
+ int consume_bytes;
int64 expected_time;
} tests[] = {
// Timestamps of 0 are treated as garbage.
diff --git a/media/crypto/aes_decryptor_unittest.cc b/media/crypto/aes_decryptor_unittest.cc
index dceeb5a..70b6881 100644
--- a/media/crypto/aes_decryptor_unittest.cc
+++ b/media/crypto/aes_decryptor_unittest.cc
@@ -40,7 +40,7 @@ class AesDecryptorTest : public testing::Test {
void DecryptAndExpectToSucceed() {
scoped_refptr<Buffer> decrypted = decryptor_.Decrypt(encrypted_data_);
ASSERT_TRUE(decrypted);
- size_t data_length = sizeof(kOriginalData) - 1;
+ int data_length = sizeof(kOriginalData) - 1;
ASSERT_EQ(data_length, decrypted->GetDataSize());
EXPECT_EQ(0, memcmp(kOriginalData, decrypted->GetData(), data_length));
}
diff --git a/media/filters/audio_renderer_algorithm_base.cc b/media/filters/audio_renderer_algorithm_base.cc
index 7495a33..990c477 100644
--- a/media/filters/audio_renderer_algorithm_base.cc
+++ b/media/filters/audio_renderer_algorithm_base.cc
@@ -17,11 +17,11 @@ namespace media {
// The starting size in bytes for |audio_buffer_|.
// Previous usage maintained a deque of 16 Buffers, each of size 4Kb. This
// worked well, so we maintain this number of bytes (16 * 4096).
-static const size_t kStartingBufferSizeInBytes = 65536;
+static const int kStartingBufferSizeInBytes = 65536;
// The maximum size in bytes for the |audio_buffer_|. Arbitrarily determined.
// This number represents 3 seconds of 96kHz/16 bit 7.1 surround sound.
-static const size_t kMaxBufferSizeInBytes = 4608000;
+static const int kMaxBufferSizeInBytes = 4608000;
// Duration of audio segments used for crossfading (in seconds).
static const double kWindowDuration = 0.08;
@@ -104,14 +104,14 @@ void AudioRendererAlgorithmBase::Initialize(
crossfade_buffer_.reset(new uint8[bytes_in_crossfade_]);
}
-uint32 AudioRendererAlgorithmBase::FillBuffer(
- uint8* dest, uint32 requested_frames) {
- DCHECK_NE(bytes_per_frame_, 0u);
+int AudioRendererAlgorithmBase::FillBuffer(
+ uint8* dest, int requested_frames) {
+ DCHECK_NE(bytes_per_frame_, 0);
if (playback_rate_ == 0.0f)
return 0;
- uint32 total_frames_rendered = 0;
+ int total_frames_rendered = 0;
uint8* output_ptr = dest;
while (total_frames_rendered < requested_frames) {
if (index_into_window_ == window_size_)
@@ -159,25 +159,25 @@ bool AudioRendererAlgorithmBase::OutputFasterPlayback(uint8* dest) {
//
// The duration of each phase is computed below based on the |window_size_|
// and |playback_rate_|.
- uint32 input_step = window_size_;
- uint32 output_step = ceil(window_size_ / playback_rate_);
+ int input_step = window_size_;
+ int output_step = ceil(window_size_ / playback_rate_);
AlignToFrameBoundary(&output_step);
DCHECK_GT(input_step, output_step);
- uint32 bytes_to_crossfade = bytes_in_crossfade_;
+ int bytes_to_crossfade = bytes_in_crossfade_;
if (muted_ || bytes_to_crossfade > output_step)
bytes_to_crossfade = 0;
// This is the index of the end of phase a, beginning of phase b.
- uint32 outtro_crossfade_begin = output_step - bytes_to_crossfade;
+ int outtro_crossfade_begin = output_step - bytes_to_crossfade;
// This is the index of the end of phase b, beginning of phase c.
- uint32 outtro_crossfade_end = output_step;
+ int outtro_crossfade_end = output_step;
// This is the index of the end of phase c, beginning of phase d.
// This phase continues until |index_into_window_| reaches |window_size_|, at
// which point the window restarts.
- uint32 intro_crossfade_begin = input_step - bytes_to_crossfade;
+ int intro_crossfade_begin = input_step - bytes_to_crossfade;
// a) Output a raw frame if we haven't reached the crossfade section.
if (index_into_window_ < outtro_crossfade_begin) {
@@ -193,7 +193,7 @@ bool AudioRendererAlgorithmBase::OutputFasterPlayback(uint8* dest) {
return false;
// This phase only applies if there are bytes to crossfade.
- DCHECK_GT(bytes_to_crossfade, 0u);
+ DCHECK_GT(bytes_to_crossfade, 0);
uint8* place_to_copy = crossfade_buffer_.get() +
(index_into_window_ - outtro_crossfade_begin);
CopyWithAdvance(place_to_copy);
@@ -221,7 +221,7 @@ bool AudioRendererAlgorithmBase::OutputFasterPlayback(uint8* dest) {
// d) Crossfade and output a frame.
DCHECK_LT(index_into_window_, window_size_);
- uint32 offset_into_buffer = index_into_window_ - intro_crossfade_begin;
+ int offset_into_buffer = index_into_window_ - intro_crossfade_begin;
memcpy(dest, crossfade_buffer_.get() + offset_into_buffer,
bytes_per_frame_);
scoped_array<uint8> intro_frame_ptr(new uint8[bytes_per_frame_]);
@@ -252,25 +252,25 @@ bool AudioRendererAlgorithmBase::OutputSlowerPlayback(uint8* dest) {
//
// The duration of each phase is computed below based on the |window_size_|
// and |playback_rate_|.
- uint32 input_step = ceil(window_size_ * playback_rate_);
+ int input_step = ceil(window_size_ * playback_rate_);
AlignToFrameBoundary(&input_step);
- uint32 output_step = window_size_;
+ int output_step = window_size_;
DCHECK_LT(input_step, output_step);
- uint32 bytes_to_crossfade = bytes_in_crossfade_;
+ int bytes_to_crossfade = bytes_in_crossfade_;
if (muted_ || bytes_to_crossfade > input_step)
bytes_to_crossfade = 0;
// This is the index of the end of phase a, beginning of phase b.
- uint32 intro_crossfade_begin = input_step - bytes_to_crossfade;
+ int intro_crossfade_begin = input_step - bytes_to_crossfade;
// This is the index of the end of phase b, beginning of phase c.
- uint32 intro_crossfade_end = input_step;
+ int intro_crossfade_end = input_step;
// This is the index of the end of phase c, beginning of phase d.
// This phase continues until |index_into_window_| reaches |window_size_|, at
// which point the window restarts.
- uint32 outtro_crossfade_begin = output_step - bytes_to_crossfade;
+ int outtro_crossfade_begin = output_step - bytes_to_crossfade;
// a) Output a raw frame.
if (index_into_window_ < intro_crossfade_begin) {
@@ -282,7 +282,7 @@ bool AudioRendererAlgorithmBase::OutputSlowerPlayback(uint8* dest) {
// b) Save the raw frame for the intro crossfade section, then output the
// frame to |dest|.
if (index_into_window_ < intro_crossfade_end) {
- uint32 offset = index_into_window_ - intro_crossfade_begin;
+ int offset = index_into_window_ - intro_crossfade_begin;
uint8* place_to_copy = crossfade_buffer_.get() + offset;
CopyWithoutAdvance(place_to_copy);
CopyWithAdvance(dest);
@@ -290,7 +290,7 @@ bool AudioRendererAlgorithmBase::OutputSlowerPlayback(uint8* dest) {
return true;
}
- uint32 audio_buffer_offset = index_into_window_ - intro_crossfade_end;
+ int audio_buffer_offset = index_into_window_ - intro_crossfade_end;
if (audio_buffer_.forward_bytes() < audio_buffer_offset + bytes_per_frame_)
return false;
@@ -303,7 +303,7 @@ bool AudioRendererAlgorithmBase::OutputSlowerPlayback(uint8* dest) {
// d) Crossfade the next frame of |crossfade_buffer_| into |dest| if we've
// reached the outtro crossfade section of the window.
if (index_into_window_ >= outtro_crossfade_begin) {
- uint32 offset_into_crossfade_buffer =
+ int offset_into_crossfade_buffer =
index_into_window_ - outtro_crossfade_begin;
uint8* intro_frame_ptr =
crossfade_buffer_.get() + offset_into_crossfade_buffer;
@@ -333,12 +333,12 @@ void AudioRendererAlgorithmBase::CopyWithoutAdvance(uint8* dest) {
}
void AudioRendererAlgorithmBase::CopyWithoutAdvance(
- uint8* dest, uint32 offset) {
+ uint8* dest, int offset) {
if (muted_) {
memset(dest, 0, bytes_per_frame_);
return;
}
- uint32 copied = audio_buffer_.Peek(dest, bytes_per_frame_, offset);
+ int copied = audio_buffer_.Peek(dest, bytes_per_frame_, offset);
DCHECK_EQ(bytes_per_frame_, copied);
}
@@ -375,7 +375,7 @@ void AudioRendererAlgorithmBase::CrossfadeFrame(
Type* outtro = reinterpret_cast<Type*>(outtro_bytes);
const Type* intro = reinterpret_cast<const Type*>(intro_bytes);
- uint32 frames_in_crossfade = bytes_in_crossfade_ / bytes_per_frame_;
+ int frames_in_crossfade = bytes_in_crossfade_ / bytes_per_frame_;
float crossfade_ratio =
static_cast<float>(crossfade_frame_number_) / frames_in_crossfade;
for (int channel = 0; channel < channels_; ++channel) {
@@ -394,7 +394,7 @@ void AudioRendererAlgorithmBase::SetPlaybackRate(float new_rate) {
ResetWindow();
}
-void AudioRendererAlgorithmBase::AlignToFrameBoundary(uint32* value) {
+void AudioRendererAlgorithmBase::AlignToFrameBoundary(int* value) {
(*value) -= ((*value) % bytes_per_frame_);
}
@@ -432,7 +432,7 @@ bool AudioRendererAlgorithmBase::IsQueueFull() {
return audio_buffer_.forward_bytes() >= audio_buffer_.forward_capacity();
}
-uint32 AudioRendererAlgorithmBase::QueueCapacity() {
+int AudioRendererAlgorithmBase::QueueCapacity() {
return audio_buffer_.forward_capacity();
}
diff --git a/media/filters/audio_renderer_algorithm_base.h b/media/filters/audio_renderer_algorithm_base.h
index 9e7d8a8..0e5083e 100644
--- a/media/filters/audio_renderer_algorithm_base.h
+++ b/media/filters/audio_renderer_algorithm_base.h
@@ -30,8 +30,6 @@ namespace media {
class Buffer;
-// TODO(vrk): Remove all the uint32s from AudioRendererAlgorithmBase and
-// replace them with ints.
class MEDIA_EXPORT AudioRendererAlgorithmBase {
public:
AudioRendererAlgorithmBase();
@@ -61,7 +59,7 @@ class MEDIA_EXPORT AudioRendererAlgorithmBase {
//
// Returns the number of frames copied into |dest|.
// May request more reads via |request_read_cb_| before returning.
- uint32 FillBuffer(uint8* dest, uint32 requested_frames);
+ int FillBuffer(uint8* dest, int requested_frames);
// Clears |audio_buffer_|.
void FlushBuffers();
@@ -84,7 +82,7 @@ class MEDIA_EXPORT AudioRendererAlgorithmBase {
bool IsQueueFull();
// Returns the capacity of |audio_buffer_|.
- uint32 QueueCapacity();
+ int QueueCapacity();
// Increase the capacity of |audio_buffer_| if possible.
void IncreaseQueueCapacity();
@@ -92,11 +90,11 @@ class MEDIA_EXPORT AudioRendererAlgorithmBase {
// Returns the number of bytes left in |audio_buffer_|, which may be larger
// than QueueCapacity() in the event that a read callback delivered more data
// than |audio_buffer_| was intending to hold.
- uint32 bytes_buffered() { return audio_buffer_.forward_bytes(); }
+ int bytes_buffered() { return audio_buffer_.forward_bytes(); }
- uint32 bytes_per_frame() { return bytes_per_frame_; }
+ int bytes_per_frame() { return bytes_per_frame_; }
- uint32 bytes_per_channel() { return bytes_per_channel_; }
+ int bytes_per_channel() { return bytes_per_channel_; }
bool is_muted() { return muted_; }
@@ -136,7 +134,7 @@ class MEDIA_EXPORT AudioRendererAlgorithmBase {
// |audio_buffer_|'s internal "current" cursor. Optionally peeks at a forward
// byte |offset|.
void CopyWithoutAdvance(uint8* dest);
- void CopyWithoutAdvance(uint8* dest, uint32 offset);
+ void CopyWithoutAdvance(uint8* dest, int offset);
// Copies a raw frame from |audio_buffer_| into |dest| and progresses the
// |audio_buffer_| forward.
@@ -152,7 +150,7 @@ class MEDIA_EXPORT AudioRendererAlgorithmBase {
void CrossfadeFrame(uint8* outtro, const uint8* intro);
// Rounds |*value| down to the nearest frame boundary.
- void AlignToFrameBoundary(uint32* value);
+ void AlignToFrameBoundary(int* value);
// Number of channels in audio stream.
int channels_;
@@ -173,18 +171,18 @@ class MEDIA_EXPORT AudioRendererAlgorithmBase {
SeekableBuffer audio_buffer_;
// Length for crossfade in bytes.
- uint32 bytes_in_crossfade_;
+ int bytes_in_crossfade_;
// Length of frame in bytes.
- uint32 bytes_per_frame_;
+ int bytes_per_frame_;
// The current location in the audio window, between 0 and |window_size_|.
// When |index_into_window_| reaches |window_size_|, the window resets.
// Indexed by byte.
- uint32 index_into_window_;
+ int index_into_window_;
// The frame number in the crossfade.
- uint32 crossfade_frame_number_;
+ int crossfade_frame_number_;
// True if the audio should be muted.
bool muted_;
@@ -195,7 +193,7 @@ class MEDIA_EXPORT AudioRendererAlgorithmBase {
scoped_array<uint8> crossfade_buffer_;
// Window size, in bytes (calculated from audio properties).
- uint32 window_size_;
+ int window_size_;
DISALLOW_COPY_AND_ASSIGN(AudioRendererAlgorithmBase);
};
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index a31cfac..6d907d5 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -40,8 +40,8 @@ class AVPacketBuffer : public Buffer {
return reinterpret_cast<const uint8*>(packet_->data);
}
- virtual size_t GetDataSize() const {
- return static_cast<size_t>(packet_->size);
+ virtual int GetDataSize() const {
+ return packet_->size;
}
private:
@@ -389,13 +389,13 @@ size_t FFmpegDemuxer::Read(size_t size, uint8* data) {
return 0;
// Asynchronous read from data source.
- data_source_->Read(read_position_, size, data,
- base::Bind(&FFmpegDemuxer::OnReadCompleted, this));
+ data_source_->Read(read_position_, size, data, base::Bind(
+ &FFmpegDemuxer::SignalReadCompleted, this));
// TODO(hclam): The method is called on the demuxer thread and this method
// call will block the thread. We need to implemented an additional thread to
// let FFmpeg demuxer methods to run on.
- size_t last_read_bytes = WaitForRead();
+ int last_read_bytes = WaitForRead();
if (last_read_bytes == DataSource::kReadError) {
if (host())
host()->OnDemuxerError(PIPELINE_ERROR_READ);
@@ -733,16 +733,12 @@ void FFmpegDemuxer::StreamHasEnded() {
}
}
-void FFmpegDemuxer::OnReadCompleted(size_t size) {
- SignalReadCompleted(size);
-}
-
-size_t FFmpegDemuxer::WaitForRead() {
+int FFmpegDemuxer::WaitForRead() {
read_event_.Wait();
return last_read_bytes_;
}
-void FFmpegDemuxer::SignalReadCompleted(size_t size) {
+void FFmpegDemuxer::SignalReadCompleted(int size) {
last_read_bytes_ = size;
read_event_.Signal();
}
diff --git a/media/filters/ffmpeg_demuxer.h b/media/filters/ffmpeg_demuxer.h
index 0d1fb86..4efcde5 100644
--- a/media/filters/ffmpeg_demuxer.h
+++ b/media/filters/ffmpeg_demuxer.h
@@ -199,16 +199,12 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol {
// Must be called on the demuxer thread.
void StreamHasEnded();
- // Read callback method to be passed to DataSource. When the asynchronous
- // read has completed, this method will be called from DataSource with
- // number of bytes read or kDataSource in case of error.
- void OnReadCompleted(size_t size);
-
// Wait for asynchronous read to complete and return number of bytes read.
- virtual size_t WaitForRead();
+ virtual int WaitForRead();
- // Signal that read has completed, and |size| bytes have been read.
- virtual void SignalReadCompleted(size_t size);
+ // Signal the blocked thread that the read has completed, with |size| bytes
+ // read or kReadError in case of error.
+ virtual void SignalReadCompleted(int size);
MessageLoop* message_loop_;
@@ -244,7 +240,7 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol {
// never be reset. This flag is set true and accessed in Read().
bool read_has_failed_;
- size_t last_read_bytes_;
+ int last_read_bytes_;
int64 read_position_;
// Initialization can happen before set_host() is called, in which case we
diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc
index 1313cb4..3189e08 100644
--- a/media/filters/ffmpeg_demuxer_unittest.cc
+++ b/media/filters/ffmpeg_demuxer_unittest.cc
@@ -103,7 +103,7 @@ class FFmpegDemuxerTest : public testing::Test {
// This makes it easier to track down where test failures occur.
void ValidateBuffer(const tracked_objects::Location& location,
const scoped_refptr<Buffer>& buffer,
- size_t size, int64 timestampInMicroseconds) {
+ int size, int64 timestampInMicroseconds) {
std::string location_str;
location.Write(true, false, &location_str);
location_str += "\n";
@@ -341,12 +341,12 @@ TEST_F(FFmpegDemuxerTest, Read_EndOfStream) {
if (reader->buffer()->IsEndOfStream()) {
got_eos_buffer = true;
EXPECT_TRUE(reader->buffer()->GetData() == NULL);
- EXPECT_EQ(0u, reader->buffer()->GetDataSize());
+ EXPECT_EQ(0, reader->buffer()->GetDataSize());
break;
}
EXPECT_TRUE(reader->buffer()->GetData() != NULL);
- EXPECT_GT(reader->buffer()->GetDataSize(), 0u);
+ EXPECT_GT(reader->buffer()->GetDataSize(), 0);
reader->Reset();
}
@@ -553,15 +553,15 @@ class MockFFmpegDemuxer : public FFmpegDemuxer {
}
virtual ~MockFFmpegDemuxer() {}
- MOCK_METHOD0(WaitForRead, size_t());
- MOCK_METHOD1(SignalReadCompleted, void(size_t size));
+ MOCK_METHOD0(WaitForRead, int());
+ MOCK_METHOD1(SignalReadCompleted, void(int size));
private:
DISALLOW_COPY_AND_ASSIGN(MockFFmpegDemuxer);
};
// A gmock helper method to execute the callback and deletes it.
-void RunCallback(size_t size, const DataSource::ReadCB& callback) {
+void RunCallback(int size, const DataSource::ReadCB& callback) {
DCHECK(!callback.is_null());
callback.Run(size);
}
diff --git a/media/filters/file_data_source.cc b/media/filters/file_data_source.cc
index faf897b..83e103d 100644
--- a/media/filters/file_data_source.cc
+++ b/media/filters/file_data_source.cc
@@ -72,7 +72,7 @@ void FileDataSource::Stop(const base::Closure& callback) {
callback.Run();
}
-void FileDataSource::Read(int64 position, size_t size, uint8* data,
+void FileDataSource::Read(int64 position, int size, uint8* data,
const DataSource::ReadCB& read_cb) {
DCHECK(file_);
base::AutoLock l(lock_);
@@ -90,7 +90,7 @@ void FileDataSource::Read(int64 position, size_t size, uint8* data,
return;
}
#endif
- size_t size_read = fread(data, 1, size, file_);
+ int size_read = fread(data, 1, size, file_);
if (size_read == size || !ferror(file_)) {
read_cb.Run(size_read);
return;
diff --git a/media/filters/file_data_source.h b/media/filters/file_data_source.h
index 194198e..2806493 100644
--- a/media/filters/file_data_source.h
+++ b/media/filters/file_data_source.h
@@ -26,7 +26,7 @@ class MEDIA_EXPORT FileDataSource : public DataSource {
// Implementation of DataSource.
virtual void set_host(DataSourceHost* host) OVERRIDE;
virtual void Stop(const base::Closure& callback) OVERRIDE;
- virtual void Read(int64 position, size_t size, uint8* data,
+ virtual void Read(int64 position, int size, uint8* data,
const DataSource::ReadCB& read_cb) OVERRIDE;
virtual bool GetSize(int64* size_out) OVERRIDE;
virtual bool IsStreaming() OVERRIDE;
diff --git a/media/filters/file_data_source_unittest.cc b/media/filters/file_data_source_unittest.cc
index 50cbe40..c7748ab 100644
--- a/media/filters/file_data_source_unittest.cc
+++ b/media/filters/file_data_source_unittest.cc
@@ -23,7 +23,7 @@ class ReadCBHandler {
public:
ReadCBHandler() {}
- MOCK_METHOD1(ReadCB, void(size_t size));
+ MOCK_METHOD1(ReadCB, void(int size));
private:
DISALLOW_COPY_AND_ASSIGN(ReadCBHandler);
diff --git a/media/tools/player_x11/data_source_logger.cc b/media/tools/player_x11/data_source_logger.cc
index 828c4bc..ee3404f 100644
--- a/media/tools/player_x11/data_source_logger.cc
+++ b/media/tools/player_x11/data_source_logger.cc
@@ -12,8 +12,8 @@ static void LogAndRunStopClosure(const base::Closure& closure) {
}
static void LogAndRunReadCB(
- int64 position, size_t size,
- const media::DataSource::ReadCB& read_cb, size_t result) {
+ int64 position, int size,
+ const media::DataSource::ReadCB& read_cb, int result) {
VLOG(1) << "Read(" << position << ", " << size << ") -> " << result;
read_cb.Run(result);
}
@@ -38,7 +38,7 @@ void DataSourceLogger::Stop(const base::Closure& closure) {
}
void DataSourceLogger::Read(
- int64 position, size_t size, uint8* data,
+ int64 position, int size, uint8* data,
const media::DataSource::ReadCB& read_cb) {
VLOG(1) << "Read(" << position << ", " << size << ")";
data_source_->Read(position, size, data, base::Bind(
diff --git a/media/tools/player_x11/data_source_logger.h b/media/tools/player_x11/data_source_logger.h
index 44f5495..e2f6329 100644
--- a/media/tools/player_x11/data_source_logger.h
+++ b/media/tools/player_x11/data_source_logger.h
@@ -25,7 +25,7 @@ class DataSourceLogger : public media::DataSource {
virtual void set_host(media::DataSourceHost* host) OVERRIDE;
virtual void Stop(const base::Closure& closure) OVERRIDE;
virtual void Read(
- int64 position, size_t size, uint8* data,
+ int64 position, int size, uint8* data,
const media::DataSource::ReadCB& read_cb) OVERRIDE;
virtual bool GetSize(int64* size_out) OVERRIDE;
virtual bool IsStreaming() OVERRIDE;
diff --git a/webkit/media/buffered_data_source.cc b/webkit/media/buffered_data_source.cc
index 1d39684..a5e94bd 100644
--- a/webkit/media/buffered_data_source.cc
+++ b/webkit/media/buffered_data_source.cc
@@ -139,7 +139,7 @@ void BufferedDataSource::SetBitrate(int bitrate) {
/////////////////////////////////////////////////////////////////////////////
// media::DataSource implementation.
void BufferedDataSource::Read(
- int64 position, size_t size, uint8* data,
+ int64 position, int size, uint8* data,
const media::DataSource::ReadCB& read_cb) {
DVLOG(1) << "Read: " << position << " offset, " << size << " bytes";
DCHECK(!read_cb.is_null());
@@ -157,8 +157,7 @@ void BufferedDataSource::Read(
}
render_loop_->PostTask(FROM_HERE, base::Bind(
- &BufferedDataSource::ReadTask, this,
- position, static_cast<int>(size), data));
+ &BufferedDataSource::ReadTask, this, position, size, data));
}
bool BufferedDataSource::GetSize(int64* size_out) {
@@ -334,7 +333,7 @@ void BufferedDataSource::DoneRead_Locked(int error) {
lock_.AssertAcquired();
if (error >= 0) {
- read_cb_.Run(static_cast<size_t>(error));
+ read_cb_.Run(error);
} else {
read_cb_.Run(kReadError);
}
diff --git a/webkit/media/buffered_data_source.h b/webkit/media/buffered_data_source.h
index e9d979e..9935c51 100644
--- a/webkit/media/buffered_data_source.h
+++ b/webkit/media/buffered_data_source.h
@@ -36,11 +36,8 @@ class BufferedDataSource : public WebDataSource {
virtual void Stop(const base::Closure& closure) OVERRIDE;
virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
- virtual void Read(
- int64 position,
- size_t size,
- uint8* data,
- const media::DataSource::ReadCB& read_cb) OVERRIDE;
+ virtual void Read(int64 position, int size, uint8* data,
+ const media::DataSource::ReadCB& read_cb) OVERRIDE;
virtual bool GetSize(int64* size_out) OVERRIDE;
virtual bool IsStreaming() OVERRIDE;
virtual void SetPreload(media::Preload preload) OVERRIDE;
diff --git a/webkit/media/buffered_data_source_unittest.cc b/webkit/media/buffered_data_source_unittest.cc
index 982e47b..eecadfe 100644
--- a/webkit/media/buffered_data_source_unittest.cc
+++ b/webkit/media/buffered_data_source_unittest.cc
@@ -72,7 +72,7 @@ class MockBufferedDataSource : public BufferedDataSource {
static const int64 kFileSize = 5000000;
static const int64 kFarReadPosition = 4000000;
-static const size_t kDataSize = 1024;
+static const int kDataSize = 1024;
class BufferedDataSourceTest : public testing::Test {
public:
@@ -144,7 +144,7 @@ class BufferedDataSourceTest : public testing::Test {
message_loop_->RunAllPending();
}
- MOCK_METHOD1(ReadCallback, void(size_t size));
+ MOCK_METHOD1(ReadCallback, void(int size));
void ReadAt(int64 position) {
data_source_->Read(position, kDataSize, buffer_,
diff --git a/webkit/media/buffered_resource_loader_unittest.cc b/webkit/media/buffered_resource_loader_unittest.cc
index b995268..6073df2 100644
--- a/webkit/media/buffered_resource_loader_unittest.cc
+++ b/webkit/media/buffered_resource_loader_unittest.cc
@@ -89,7 +89,7 @@ class BufferedResourceLoaderTest : public testing::Test {
loader_->SetURLLoaderForTest(scoped_ptr<WebKit::WebURLLoader>(url_loader_));
}
- void SetLoaderBuffer(size_t forward_capacity, size_t backward_capacity) {
+ void SetLoaderBuffer(int forward_capacity, int backward_capacity) {
loader_->buffer_.reset(
new media::SeekableBuffer(backward_capacity, forward_capacity));
}
@@ -213,8 +213,8 @@ class BufferedResourceLoaderTest : public testing::Test {
}
void WriteUntilThreshold() {
- size_t buffered = loader_->buffer_->forward_bytes();
- size_t capacity = loader_->buffer_->forward_capacity();
+ int buffered = loader_->buffer_->forward_bytes();
+ int capacity = loader_->buffer_->forward_capacity();
CHECK_LT(buffered, capacity);
EXPECT_CALL(*this, NetworkCallback());
@@ -242,22 +242,22 @@ class BufferedResourceLoaderTest : public testing::Test {
EXPECT_EQ(loader_->last_offset_, expected_last_offset);
}
- void ConfirmBufferState(size_t backward_bytes,
- size_t backward_capacity,
- size_t forward_bytes,
- size_t forward_capacity) {
+ void ConfirmBufferState(int backward_bytes,
+ int backward_capacity,
+ int forward_bytes,
+ int forward_capacity) {
EXPECT_EQ(backward_bytes, loader_->buffer_->backward_bytes());
EXPECT_EQ(backward_capacity, loader_->buffer_->backward_capacity());
EXPECT_EQ(forward_bytes, loader_->buffer_->forward_bytes());
EXPECT_EQ(forward_capacity, loader_->buffer_->forward_capacity());
}
- void ConfirmLoaderBufferBackwardCapacity(size_t expected_backward_capacity) {
+ void ConfirmLoaderBufferBackwardCapacity(int expected_backward_capacity) {
EXPECT_EQ(loader_->buffer_->backward_capacity(),
expected_backward_capacity);
}
- void ConfirmLoaderBufferForwardCapacity(size_t expected_forward_capacity) {
+ void ConfirmLoaderBufferForwardCapacity(int expected_forward_capacity) {
EXPECT_EQ(loader_->buffer_->forward_capacity(), expected_forward_capacity);
}
@@ -268,12 +268,12 @@ class BufferedResourceLoaderTest : public testing::Test {
// Makes sure the |loader_| buffer window is in a reasonable range.
void CheckBufferWindowBounds() {
// Corresponds to value defined in buffered_resource_loader.cc.
- static const size_t kMinBufferCapacity = 2 * 1024 * 1024;
+ static const int kMinBufferCapacity = 2 * 1024 * 1024;
EXPECT_GE(loader_->buffer_->forward_capacity(), kMinBufferCapacity);
EXPECT_GE(loader_->buffer_->backward_capacity(), kMinBufferCapacity);
// Corresponds to value defined in buffered_resource_loader.cc.
- static const size_t kMaxBufferCapacity = 20 * 1024 * 1024;
+ static const int kMaxBufferCapacity = 20 * 1024 * 1024;
EXPECT_LE(loader_->buffer_->forward_capacity(), kMaxBufferCapacity);
EXPECT_LE(loader_->buffer_->backward_capacity(), kMaxBufferCapacity);
}
@@ -283,8 +283,8 @@ class BufferedResourceLoaderTest : public testing::Test {
MOCK_METHOD0(NetworkCallback, void());
// Accessors for private variables on |loader_|.
- size_t forward_bytes() { return loader_->buffer_->forward_bytes(); }
- size_t forward_capacity() { return loader_->buffer_->forward_capacity(); }
+ int forward_bytes() { return loader_->buffer_->forward_bytes(); }
+ int forward_capacity() { return loader_->buffer_->forward_capacity(); }
protected:
GURL gurl_;
@@ -943,8 +943,8 @@ TEST_F(BufferedResourceLoaderTest, Tricky_LargeReadBackwards) {
}
TEST_F(BufferedResourceLoaderTest, Tricky_ReadPastThreshold) {
- const size_t kSize = 5 * 1024 * 1024;
- const size_t kThreshold = 2 * 1024 * 1024;
+ const int kSize = 5 * 1024 * 1024;
+ const int kThreshold = 2 * 1024 * 1024;
Initialize(kHttpUrl, 10, kSize);
SetLoaderBuffer(10, 10);