summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--media/filters/ffmpeg_demuxer.cc2
-rw-r--r--media/filters/ffmpeg_demuxer.h4
-rw-r--r--media/filters/ffmpeg_demuxer_unittest.cc6
-rw-r--r--media/filters/ffmpeg_glue.h2
-rw-r--r--media/filters/ffmpeg_glue_unittest.cc2
-rw-r--r--media/filters/in_memory_url_protocol.cc9
-rw-r--r--media/filters/in_memory_url_protocol.h2
7 files changed, 12 insertions, 15 deletions
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 623a6e5..45e5298 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -368,7 +368,7 @@ base::TimeDelta FFmpegDemuxer::GetStartTime() const {
return start_time_;
}
-int FFmpegDemuxer::Read(int size, uint8* data) {
+size_t FFmpegDemuxer::Read(size_t size, uint8* data) {
DCHECK(data_source_);
// If read has ever failed, return with an error.
diff --git a/media/filters/ffmpeg_demuxer.h b/media/filters/ffmpeg_demuxer.h
index 2622111..1c1dfc2 100644
--- a/media/filters/ffmpeg_demuxer.h
+++ b/media/filters/ffmpeg_demuxer.h
@@ -148,8 +148,8 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol {
virtual void SetPreload(Preload preload) OVERRIDE;
virtual base::TimeDelta GetStartTime() const OVERRIDE;
- // FFmpegProtocol implementation.
- virtual int Read(int size, uint8* data) OVERRIDE;
+ // FFmpegURLProtocol implementation.
+ virtual size_t Read(size_t size, uint8* data) OVERRIDE;
virtual bool GetPosition(int64* position_out) OVERRIDE;
virtual bool SetPosition(int64 position) OVERRIDE;
virtual bool GetSize(int64* size_out) OVERRIDE;
diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc
index 24fcdc3..64c6095 100644
--- a/media/filters/ffmpeg_demuxer_unittest.cc
+++ b/media/filters/ffmpeg_demuxer_unittest.cc
@@ -553,18 +553,18 @@ TEST_F(FFmpegDemuxerTest, ProtocolRead) {
.WillOnce(DoAll(SetArgPointee<0>(1024), Return(true)));
// First read.
- EXPECT_EQ(512, demuxer->Read(512, kBuffer));
+ EXPECT_EQ(512u, demuxer->Read(512, kBuffer));
int64 position;
EXPECT_TRUE(demuxer->GetPosition(&position));
EXPECT_EQ(512, position);
// Second read.
- EXPECT_EQ(512, demuxer->Read(512, kBuffer));
+ EXPECT_EQ(512u, demuxer->Read(512, kBuffer));
EXPECT_TRUE(demuxer->GetPosition(&position));
EXPECT_EQ(1024, position);
// Third read will get an end-of-file error, which is represented as zero.
- EXPECT_EQ(0, demuxer->Read(512, kBuffer));
+ EXPECT_EQ(0u, demuxer->Read(512, kBuffer));
// This read complete signal is generated when demuxer is stopped.
EXPECT_CALL(*demuxer, SignalReadCompleted(DataSource::kReadError));
diff --git a/media/filters/ffmpeg_glue.h b/media/filters/ffmpeg_glue.h
index 570dd80..257915e 100644
--- a/media/filters/ffmpeg_glue.h
+++ b/media/filters/ffmpeg_glue.h
@@ -45,7 +45,7 @@ class MEDIA_EXPORT FFmpegURLProtocol {
// Read the given amount of bytes into data, returns the number of bytes read
// if successful, kReadError otherwise.
- virtual int Read(int size, uint8* data) = 0;
+ virtual size_t Read(size_t size, uint8* data) = 0;
// Returns true and the current file position for this file, false if the
// file position could not be retrieved.
diff --git a/media/filters/ffmpeg_glue_unittest.cc b/media/filters/ffmpeg_glue_unittest.cc
index 0ea91f1..94258e9 100644
--- a/media/filters/ffmpeg_glue_unittest.cc
+++ b/media/filters/ffmpeg_glue_unittest.cc
@@ -23,7 +23,7 @@ class MockProtocol : public FFmpegURLProtocol {
MockProtocol() {
}
- MOCK_METHOD2(Read, int(int size, uint8* data));
+ MOCK_METHOD2(Read, size_t(size_t size, uint8* data));
MOCK_METHOD1(GetPosition, bool(int64* position_out));
MOCK_METHOD1(SetPosition, bool(int64 position));
MOCK_METHOD1(GetSize, bool(int64* size_out));
diff --git a/media/filters/in_memory_url_protocol.cc b/media/filters/in_memory_url_protocol.cc
index dd7d984b..cdff519 100644
--- a/media/filters/in_memory_url_protocol.cc
+++ b/media/filters/in_memory_url_protocol.cc
@@ -9,18 +9,15 @@ namespace media {
InMemoryUrlProtocol::InMemoryUrlProtocol(const uint8* data, int64 size,
bool streaming)
: data_(data),
- size_(size),
+ size_(size >= 0 ? size : 0),
position_(0),
streaming_(streaming) {
}
InMemoryUrlProtocol::~InMemoryUrlProtocol() {}
-int InMemoryUrlProtocol::Read(int size, uint8* data) {
- if (size < 0)
- return -1;
-
- int available_bytes = static_cast<int>(size_ - position_);
+size_t InMemoryUrlProtocol::Read(size_t size, uint8* data) {
+ size_t available_bytes = size_ - position_;
if (size > available_bytes)
size = available_bytes;
diff --git a/media/filters/in_memory_url_protocol.h b/media/filters/in_memory_url_protocol.h
index 7a5c468..1e6309a 100644
--- a/media/filters/in_memory_url_protocol.h
+++ b/media/filters/in_memory_url_protocol.h
@@ -21,7 +21,7 @@ class MEDIA_EXPORT InMemoryUrlProtocol : public FFmpegURLProtocol {
virtual ~InMemoryUrlProtocol();
// FFmpegURLProtocol methods.
- virtual int Read(int size, uint8* data);
+ virtual size_t Read(size_t size, uint8* data);
virtual bool GetPosition(int64* position_out);
virtual bool SetPosition(int64 position);
virtual bool GetSize(int64* size_out);