diff --git a/packager/media/file/file.h b/packager/media/file/file.h index 6a240d147e..01bfe05f8d 100644 --- a/packager/media/file/file.h +++ b/packager/media/file/file.h @@ -66,9 +66,6 @@ class File { /// @return true on success, false otherwise. virtual bool Flush() = 0; - /// @return true if the file reaches eof, false otherwise. - virtual bool Eof() = 0; - /// @return The file name. const std::string& file_name() const { return file_name_; } diff --git a/packager/media/file/file_unittest.cc b/packager/media/file/file_unittest.cc index 0263e3e1ac..dc478e7167 100644 --- a/packager/media/file/file_unittest.cc +++ b/packager/media/file/file_unittest.cc @@ -80,16 +80,16 @@ TEST_F(LocalFileTest, Read_And_Eof) { File* file = File::Open(local_file_name_.c_str(), "r"); ASSERT_TRUE(file != NULL); - // Read half of the file and verify that Eof is not true. + // Read half of the file. const int kFirstReadBytes = kDataSize / 2; std::string read_data(kFirstReadBytes + kDataSize, 0); EXPECT_EQ(kFirstReadBytes, file->Read(&read_data[0], kFirstReadBytes)); - EXPECT_FALSE(file->Eof()); - // Read the remaining half of the file and verify Eof is true. + // Read the remaining half of the file and verify EOF. EXPECT_EQ(kDataSize - kFirstReadBytes, file->Read(&read_data[kFirstReadBytes], kDataSize)); - EXPECT_TRUE(file->Eof()); + uint8_t single_byte; + EXPECT_EQ(0, file->Read(&single_byte, sizeof(single_byte))); EXPECT_TRUE(file->Close()); // Compare data written and read. diff --git a/packager/media/file/local_file.cc b/packager/media/file/local_file.cc index e3840f5122..35a1d11082 100644 --- a/packager/media/file/local_file.cc +++ b/packager/media/file/local_file.cc @@ -59,11 +59,6 @@ bool LocalFile::Flush() { return ((fflush(internal_file_) == 0) && !ferror(internal_file_)); } -bool LocalFile::Eof() { - DCHECK(internal_file_ != NULL); - return static_cast(feof(internal_file_)); -} - LocalFile::~LocalFile() {} bool LocalFile::Open() { diff --git a/packager/media/file/local_file.h b/packager/media/file/local_file.h index 98929a44eb..18bb38ac67 100644 --- a/packager/media/file/local_file.h +++ b/packager/media/file/local_file.h @@ -32,7 +32,6 @@ class LocalFile : public File { virtual int64_t Write(const void* buffer, uint64_t length) OVERRIDE; virtual int64_t Size() OVERRIDE; virtual bool Flush() OVERRIDE; - virtual bool Eof() OVERRIDE; /// @} /// Delete a local file. diff --git a/packager/media/file/threaded_io_file.cc b/packager/media/file/threaded_io_file.cc index b6a2265efc..2c95de599b 100644 --- a/packager/media/file/threaded_io_file.cc +++ b/packager/media/file/threaded_io_file.cc @@ -109,14 +109,6 @@ bool ThreadedIoFile::Flush() { return internal_file_->Flush(); } -bool ThreadedIoFile::Eof() { - DCHECK(internal_file_); - DCHECK(thread_); - DCHECK_EQ(kInputMode, mode_); - - return eof_ && !cache_.BytesCached(); -} - void ThreadedIoFile::RunInInputMode() { DCHECK(internal_file_); DCHECK(thread_); diff --git a/packager/media/file/threaded_io_file.h b/packager/media/file/threaded_io_file.h index 7d668bd214..0f5be3285e 100644 --- a/packager/media/file/threaded_io_file.h +++ b/packager/media/file/threaded_io_file.h @@ -38,7 +38,6 @@ class ThreadedIoFile : public File { virtual int64_t Write(const void* buffer, uint64_t length) OVERRIDE; virtual int64_t Size() OVERRIDE; virtual bool Flush() OVERRIDE; - virtual bool Eof() OVERRIDE; /// @} protected: diff --git a/packager/media/file/udp_file.cc b/packager/media/file/udp_file.cc index 4477a1e33a..c376c4fc96 100644 --- a/packager/media/file/udp_file.cc +++ b/packager/media/file/udp_file.cc @@ -129,10 +129,6 @@ bool UdpFile::Flush() { return false; } -bool UdpFile::Eof() { - return socket_ == kInvalidSocket; -} - class ScopedSocket { public: explicit ScopedSocket(int sock_fd) diff --git a/packager/media/file/udp_file.h b/packager/media/file/udp_file.h index 3e9f6bf984..415c00ee7c 100644 --- a/packager/media/file/udp_file.h +++ b/packager/media/file/udp_file.h @@ -31,7 +31,6 @@ class UdpFile : public File { virtual int64_t Write(const void* buffer, uint64_t length) OVERRIDE; virtual int64_t Size() OVERRIDE; virtual bool Flush() OVERRIDE; - virtual bool Eof() OVERRIDE; /// @} protected: