diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-12 16:50:29 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-12 16:50:29 +0000 |
commit | 580a237901a89024e6a0f0d2400b448817d7b639 (patch) | |
tree | 5fc53983e6288fff09e93f01612ef2f4a01af0c8 /media | |
parent | c084925c810975c3050e512c2f4f237d14242f01 (diff) | |
download | chromium_src-580a237901a89024e6a0f0d2400b448817d7b639.zip chromium_src-580a237901a89024e6a0f0d2400b448817d7b639.tar.gz chromium_src-580a237901a89024e6a0f0d2400b448817d7b639.tar.bz2 |
Reland r136679, reverted in r136753: Delete MockDataSource, remove IsLocalSource & IsSeekable from Demuxer/Pipeline.
MockDataSource was completely unused, and Is{LocalSource,Seekable} being in the
Demuxer is leftover craxy from the DataSourceFactory / DemuxerFactory /
DownloadRateMonitor days, may they forever RIP.
BUG=120426
TBR=scherkus
Review URL: https://chromiumcodereview.appspot.com/10392069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/base/demuxer.h | 9 | ||||
-rw-r--r-- | media/base/mock_filters.cc | 23 | ||||
-rw-r--r-- | media/base/mock_filters.h | 37 | ||||
-rw-r--r-- | media/base/pipeline.cc | 10 | ||||
-rw-r--r-- | media/base/pipeline.h | 8 | ||||
-rw-r--r-- | media/base/pipeline_unittest.cc | 24 | ||||
-rw-r--r-- | media/filters/chunk_demuxer.cc | 9 | ||||
-rw-r--r-- | media/filters/chunk_demuxer.h | 2 | ||||
-rw-r--r-- | media/filters/dummy_demuxer.cc | 15 | ||||
-rw-r--r-- | media/filters/dummy_demuxer.h | 5 | ||||
-rw-r--r-- | media/filters/ffmpeg_demuxer.cc | 12 | ||||
-rw-r--r-- | media/filters/ffmpeg_demuxer.h | 9 | ||||
-rw-r--r-- | media/filters/ffmpeg_demuxer_unittest.cc | 2 | ||||
-rw-r--r-- | media/filters/pipeline_integration_test_base.cc | 3 | ||||
-rw-r--r-- | media/tools/player_wtl/movie.cc | 3 | ||||
-rw-r--r-- | media/tools/player_x11/player_x11.cc | 3 | ||||
-rw-r--r-- | media/tools/seek_tester/seek_tester.cc | 2 |
17 files changed, 11 insertions, 165 deletions
diff --git a/media/base/demuxer.h b/media/base/demuxer.h index 1e913d4..a8cf50b 100644 --- a/media/base/demuxer.h +++ b/media/base/demuxer.h @@ -70,15 +70,6 @@ class MEDIA_EXPORT Demuxer : public base::RefCountedThreadSafe<Demuxer> { // approximated. Returns 0 if it is unknown. virtual int GetBitrate() = 0; - // Returns true if the source is from a local file or stream (such as a - // webcam stream), false otherwise. - // - // TODO(scherkus): See http://crbug.com/120426 on why we should remove this. - virtual bool IsLocalSource() = 0; - - // Returns true if seeking is possible; false otherwise. - virtual bool IsSeekable() = 0; - protected: friend class base::RefCountedThreadSafe<Demuxer>; virtual ~Demuxer(); diff --git a/media/base/mock_filters.cc b/media/base/mock_filters.cc index 00347cd..a5977a4 100644 --- a/media/base/mock_filters.cc +++ b/media/base/mock_filters.cc @@ -15,29 +15,6 @@ using ::testing::Return; namespace media { -MockDataSource::MockDataSource() - : total_bytes_(-1), - buffered_bytes_(-1) { -} - -MockDataSource::~MockDataSource() {} - -void MockDataSource::set_host(DataSourceHost* data_source_host) { - DataSource::set_host(data_source_host); - - if (total_bytes_ > 0) - host()->SetTotalBytes(total_bytes_); - - if (buffered_bytes_ > 0) - host()->SetBufferedBytes(buffered_bytes_); -} - -void MockDataSource::SetTotalAndBufferedBytes(int64 total_bytes, - int64 buffered_bytes) { - total_bytes_ = total_bytes; - buffered_bytes_ = buffered_bytes; -} - MockDemuxer::MockDemuxer() {} MockDemuxer::~MockDemuxer() {} diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h index a5060d3..32b2333 100644 --- a/media/base/mock_filters.h +++ b/media/base/mock_filters.h @@ -3,8 +3,7 @@ // found in the LICENSE file. // // A new breed of mock media filters, this time using gmock! Feel free to add -// actions if you need interesting side-effects (i.e., copying data to the -// buffer passed into MockDataSource::Read()). +// actions if you need interesting side-effects. // // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock // filters to fail the test or do nothing when an unexpected method is called. @@ -70,38 +69,6 @@ class MockFilter : public Filter { DISALLOW_COPY_AND_ASSIGN(MockFilter); }; -class MockDataSource : public DataSource { - public: - MockDataSource(); - - virtual void set_host(DataSourceHost* data_source_host); - - MOCK_METHOD1(Stop, void(const base::Closure& callback)); - MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); - MOCK_METHOD2(Seek, void(base::TimeDelta time, const PipelineStatusCB& cb)); - MOCK_METHOD0(OnAudioRendererDisabled, void()); - - // DataSource implementation. - MOCK_METHOD4(Read, void(int64 position, int size, uint8* data, - const DataSource::ReadCB& callback)); - MOCK_METHOD1(GetSize, bool(int64* size_out)); - MOCK_METHOD1(SetBitrate, void(int bitrate)); - MOCK_METHOD0(IsStreaming, bool()); - - // Sets the TotalBytes & BufferedBytes values to be sent to host() when - // the set_host() is called. - void SetTotalAndBufferedBytes(int64 total_bytes, int64 buffered_bytes); - - protected: - virtual ~MockDataSource(); - - private: - int64 total_bytes_; - int64 buffered_bytes_; - - DISALLOW_COPY_AND_ASSIGN(MockDataSource); -}; - class MockDemuxer : public Demuxer { public: MockDemuxer(); @@ -115,8 +82,6 @@ class MockDemuxer : public Demuxer { MOCK_METHOD1(GetStream, scoped_refptr<DemuxerStream>(DemuxerStream::Type)); MOCK_CONST_METHOD0(GetStartTime, base::TimeDelta()); MOCK_METHOD0(GetBitrate, int()); - MOCK_METHOD0(IsLocalSource, bool()); - MOCK_METHOD0(IsSeekable, bool()); protected: virtual ~MockDemuxer(); diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc index 260f04d..623cecf 100644 --- a/media/base/pipeline.cc +++ b/media/base/pipeline.cc @@ -223,16 +223,6 @@ void Pipeline::GetNaturalVideoSize(gfx::Size* out_size) const { *out_size = natural_size_; } -bool Pipeline::IsStreaming() const { - base::AutoLock auto_lock(lock_); - return demuxer_ && !demuxer_->IsSeekable(); -} - -bool Pipeline::IsLocalSource() const { - base::AutoLock auto_lock(lock_); - return demuxer_ && demuxer_->IsLocalSource(); -} - PipelineStatistics Pipeline::GetStatistics() const { base::AutoLock auto_lock(lock_); return statistics_; diff --git a/media/base/pipeline.h b/media/base/pipeline.h index 699b5e2..73359c2 100644 --- a/media/base/pipeline.h +++ b/media/base/pipeline.h @@ -230,14 +230,6 @@ class MEDIA_EXPORT Pipeline // be 0. void GetNaturalVideoSize(gfx::Size* out_size) const; - // If this method returns true, that means the data source is a streaming - // data source. Seeking may not be possible. - bool IsStreaming() const; - - // If this method returns true, that means the data source is local and - // the network is not needed. - bool IsLocalSource() const; - // Gets the current pipeline statistics. PipelineStatistics GetStatistics() const; diff --git a/media/base/pipeline_unittest.cc b/media/base/pipeline_unittest.cc index 56d39ff..888b962 100644 --- a/media/base/pipeline_unittest.cc +++ b/media/base/pipeline_unittest.cc @@ -36,8 +36,6 @@ namespace media { static const int kTotalBytes = 1024; static const int kBufferedBytes = 1024; static const int kBitrate = 1234; -static const bool kLocalSource = false; -static const bool kSeekable = true; ACTION_P(InitializeDemuxerWithError, error) { arg1.Run(error); @@ -117,10 +115,6 @@ class PipelineTest : public ::testing::Test { // Demuxer properties. EXPECT_CALL(*mocks_->demuxer(), GetBitrate()) .WillRepeatedly(Return(kBitrate)); - EXPECT_CALL(*mocks_->demuxer(), IsLocalSource()) - .WillRepeatedly(Return(kLocalSource)); - EXPECT_CALL(*mocks_->demuxer(), IsSeekable()) - .WillRepeatedly(Return(kSeekable)); // Configure the demuxer to return the streams. for (size_t i = 0; i < streams->size(); ++i) { @@ -800,24 +794,6 @@ TEST_F(PipelineTest, StartTimeIsNonZero) { EXPECT_EQ(kStartTime, pipeline_->GetCurrentTime()); } -TEST_F(PipelineTest, DemuxerProperties) { - CreateAudioStream(); - CreateVideoStream(); - MockDemuxerStreamVector streams; - streams.push_back(audio_stream()); - streams.push_back(video_stream()); - - InitializeDemuxer(&streams); - InitializeAudioDecoder(audio_stream()); - InitializeAudioRenderer(); - InitializeVideoDecoder(video_stream()); - InitializeVideoRenderer(); - InitializePipeline(PIPELINE_OK); - - EXPECT_EQ(kLocalSource, pipeline_->IsLocalSource()); - EXPECT_NE(kSeekable, pipeline_->IsStreaming()); -} - class FlexibleCallbackRunner : public base::DelegateSimpleThread::Delegate { public: FlexibleCallbackRunner(base::TimeDelta delay, PipelineStatus status, diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc index a753c18..fdd1a97 100644 --- a/media/filters/chunk_demuxer.cc +++ b/media/filters/chunk_demuxer.cc @@ -474,15 +474,6 @@ int ChunkDemuxer::GetBitrate() { return 0; } -bool ChunkDemuxer::IsLocalSource() { - // TODO(acolwell): Report whether source is local or not. - return false; -} - -bool ChunkDemuxer::IsSeekable() { - return duration_ != kInfiniteDuration(); -} - // Demuxer implementation. scoped_refptr<DemuxerStream> ChunkDemuxer::GetStream( DemuxerStream::Type type) { diff --git a/media/filters/chunk_demuxer.h b/media/filters/chunk_demuxer.h index eb132f5..8c5dd0b 100644 --- a/media/filters/chunk_demuxer.h +++ b/media/filters/chunk_demuxer.h @@ -46,8 +46,6 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer { DemuxerStream::Type type) OVERRIDE; virtual base::TimeDelta GetStartTime() const OVERRIDE; virtual int GetBitrate() OVERRIDE; - virtual bool IsLocalSource() OVERRIDE; - virtual bool IsSeekable() OVERRIDE; // Methods used by an external object to control this demuxer. void FlushData(); diff --git a/media/filters/dummy_demuxer.cc b/media/filters/dummy_demuxer.cc index 30b0408..1b3b369 100644 --- a/media/filters/dummy_demuxer.cc +++ b/media/filters/dummy_demuxer.cc @@ -32,10 +32,9 @@ void DummyDemuxerStream::Read(const ReadCB& read_cb) {} void DummyDemuxerStream::EnableBitstreamConverter() {} -DummyDemuxer::DummyDemuxer(bool has_video, bool has_audio, bool local_source) +DummyDemuxer::DummyDemuxer(bool has_video, bool has_audio) : has_video_(has_video), - has_audio_(has_audio), - local_source_(local_source) { + has_audio_(has_audio) { streams_.resize(DemuxerStream::NUM_TYPES); if (has_audio) streams_[DemuxerStream::AUDIO] = @@ -65,14 +64,4 @@ int DummyDemuxer::GetBitrate() { return 0; } -bool DummyDemuxer::IsLocalSource() { - return local_source_; -} - -bool DummyDemuxer::IsSeekable() { - // This is always false because DummyDemuxer is only used by WebRTC and such - // streams are not seekable. - return false; -} - } // namespace media diff --git a/media/filters/dummy_demuxer.h b/media/filters/dummy_demuxer.h index 4cb72fc..e62c117 100644 --- a/media/filters/dummy_demuxer.h +++ b/media/filters/dummy_demuxer.h @@ -41,7 +41,7 @@ class DummyDemuxerStream : public DemuxerStream { class MEDIA_EXPORT DummyDemuxer : public Demuxer { public: - DummyDemuxer(bool has_video, bool has_audio, bool local_source); + DummyDemuxer(bool has_video, bool has_audio); virtual ~DummyDemuxer(); // Demuxer implementation. @@ -51,13 +51,10 @@ class MEDIA_EXPORT DummyDemuxer : public Demuxer { DemuxerStream::Type type) OVERRIDE; virtual base::TimeDelta GetStartTime() const OVERRIDE; virtual int GetBitrate() OVERRIDE; - virtual bool IsLocalSource() OVERRIDE; - virtual bool IsSeekable() OVERRIDE; private: bool has_video_; bool has_audio_; - bool local_source_; std::vector< scoped_refptr<DummyDemuxerStream> > streams_; DISALLOW_COPY_AND_ASSIGN(DummyDemuxer); diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc index 3953c60..fd688d0 100644 --- a/media/filters/ffmpeg_demuxer.cc +++ b/media/filters/ffmpeg_demuxer.cc @@ -278,11 +278,9 @@ base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp( // FFmpegDemuxer::FFmpegDemuxer( MessageLoop* message_loop, - const scoped_refptr<DataSource>& data_source, - bool local_source) + const scoped_refptr<DataSource>& data_source) : host_(NULL), message_loop_(message_loop), - local_source_(local_source), format_context_(NULL), data_source_(data_source), read_event_(false, false), @@ -592,14 +590,6 @@ int FFmpegDemuxer::GetBitrate() { return bitrate_; } -bool FFmpegDemuxer::IsLocalSource() { - return local_source_; -} - -bool FFmpegDemuxer::IsSeekable() { - return !IsStreaming(); -} - void FFmpegDemuxer::SeekTask(base::TimeDelta time, const PipelineStatusCB& cb) { DCHECK_EQ(MessageLoop::current(), message_loop_); diff --git a/media/filters/ffmpeg_demuxer.h b/media/filters/ffmpeg_demuxer.h index 02f8019..6fa0bd6 100644 --- a/media/filters/ffmpeg_demuxer.h +++ b/media/filters/ffmpeg_demuxer.h @@ -131,8 +131,7 @@ class FFmpegDemuxerStream : public DemuxerStream { class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { public: FFmpegDemuxer(MessageLoop* message_loop, - const scoped_refptr<DataSource>& data_source, - bool local_source); + const scoped_refptr<DataSource>& data_source); virtual ~FFmpegDemuxer(); // Posts a task to perform additional demuxing. @@ -149,8 +148,6 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { DemuxerStream::Type type) OVERRIDE; virtual base::TimeDelta GetStartTime() const OVERRIDE; virtual int GetBitrate() OVERRIDE; - virtual bool IsLocalSource() OVERRIDE; - virtual bool IsSeekable() OVERRIDE; // FFmpegURLProtocol implementation. virtual size_t Read(size_t size, uint8* data) OVERRIDE; @@ -204,10 +201,6 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { MessageLoop* message_loop_; - // True if the media is a local resource, false if the media require network - // access to be loaded. - bool local_source_; - // FFmpeg context handle. AVFormatContext* format_context_; diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc index f8a8888..0ec2bb0 100644 --- a/media/filters/ffmpeg_demuxer_unittest.cc +++ b/media/filters/ffmpeg_demuxer_unittest.cc @@ -69,7 +69,7 @@ class FFmpegDemuxerTest : public testing::Test { .WillRepeatedly(SaveArg<0>(¤t_read_position_)); CreateDataSource(name, disable_file_size); - demuxer_ = new FFmpegDemuxer(&message_loop_, data_source_, true); + demuxer_ = new FFmpegDemuxer(&message_loop_, data_source_); } MOCK_METHOD1(CheckPoint, void(int v)); diff --git a/media/filters/pipeline_integration_test_base.cc b/media/filters/pipeline_integration_test_base.cc index 4d65887..190fe2e 100644 --- a/media/filters/pipeline_integration_test_base.cc +++ b/media/filters/pipeline_integration_test_base.cc @@ -147,8 +147,7 @@ scoped_ptr<FilterCollection> PipelineIntegrationTestBase::CreateFilterCollection(const std::string& url) { scoped_refptr<FileDataSource> data_source = new FileDataSource(); CHECK_EQ(PIPELINE_OK, data_source->Initialize(url)); - return CreateFilterCollection(new FFmpegDemuxer( - &message_loop_, data_source, false)); + return CreateFilterCollection(new FFmpegDemuxer(&message_loop_, data_source)); } scoped_ptr<FilterCollection> diff --git a/media/tools/player_wtl/movie.cc b/media/tools/player_wtl/movie.cc index 310a5b1..3473aff 100644 --- a/media/tools/player_wtl/movie.cc +++ b/media/tools/player_wtl/movie.cc @@ -72,8 +72,7 @@ bool Movie::Open(const wchar_t* url, VideoRendererBase* video_renderer) { // Create filter collection. scoped_ptr<FilterCollection> collection(new FilterCollection()); - collection->SetDemuxer(new FFmpegDemuxer( - pipeline_loop, data_source, true)); + collection->SetDemuxer(new FFmpegDemuxer(pipeline_loop, data_source)); collection->AddAudioDecoder(new FFmpegAudioDecoder( base::Bind(&MessageLoopFactory::GetMessageLoop, base::Unretained(message_loop_factory_.get()), diff --git a/media/tools/player_x11/player_x11.cc b/media/tools/player_x11/player_x11.cc index 6b028e5..68fe80c 100644 --- a/media/tools/player_x11/player_x11.cc +++ b/media/tools/player_x11/player_x11.cc @@ -110,8 +110,7 @@ bool InitPipeline(MessageLoop* message_loop, // Create our filter factories. scoped_ptr<media::FilterCollection> collection( new media::FilterCollection()); - collection->SetDemuxer(new media::FFmpegDemuxer( - message_loop, data_source, true)); + collection->SetDemuxer(new media::FFmpegDemuxer(message_loop, data_source)); collection->AddAudioDecoder(new media::FFmpegAudioDecoder( base::Bind(&media::MessageLoopFactory::GetMessageLoop, base::Unretained(message_loop_factory), diff --git a/media/tools/seek_tester/seek_tester.cc b/media/tools/seek_tester/seek_tester.cc index 65046ef..b14628c 100644 --- a/media/tools/seek_tester/seek_tester.cc +++ b/media/tools/seek_tester/seek_tester.cc @@ -65,7 +65,7 @@ int main(int argc, char** argv) { MessageLoop loop; media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); scoped_refptr<media::FFmpegDemuxer> demuxer( - new media::FFmpegDemuxer(&loop, file_data_source, true)); + new media::FFmpegDemuxer(&loop, file_data_source)); demuxer->Initialize(&host, quitter); loop.Run(); |