diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 18:35:10 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 18:35:10 +0000 |
commit | 5a1db428d1e9b13adeda8f452cabe208ce9f15ad (patch) | |
tree | 42726884256e8f73fa21db778007e651bfc0334d /media/base/pipeline_impl_unittest.cc | |
parent | bb65c88242cff032627558e8c22013f706cdeace (diff) | |
download | chromium_src-5a1db428d1e9b13adeda8f452cabe208ce9f15ad.zip chromium_src-5a1db428d1e9b13adeda8f452cabe208ce9f15ad.tar.gz chromium_src-5a1db428d1e9b13adeda8f452cabe208ce9f15ad.tar.bz2 |
Free demuxed audio packets if audio device fails
BUG=17481
TEST=media_unittests
Introduced a mesage broadcasting mechanism to notify filters of events from
another filter. In particular this is used to notify all filters that the
audio device has failed and special actions should be taken to handle it. In
this case, demuxer should disable the audio stream and should free the demuxed
audio packets instead of caching them. This will fix the memory leak that
happens if audio device fails during playback.
Review URL: http://codereview.chromium.org/159845
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/pipeline_impl_unittest.cc')
-rw-r--r-- | media/base/pipeline_impl_unittest.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/media/base/pipeline_impl_unittest.cc b/media/base/pipeline_impl_unittest.cc index 6400049..f3c0297 100644 --- a/media/base/pipeline_impl_unittest.cc +++ b/media/base/pipeline_impl_unittest.cc @@ -439,4 +439,45 @@ TEST_F(PipelineImplTest, Properties) { pipeline_->GetBufferedTime().ToInternalValue()); } +TEST_F(PipelineImplTest, BroadcastMessage) { + scoped_refptr<StrictMock<MockDemuxerStream> > audio_stream = + new StrictMock<MockDemuxerStream>("audio/x-foo"); + scoped_refptr<StrictMock<MockDemuxerStream> > video_stream = + new StrictMock<MockDemuxerStream>("video/x-foo"); + MockDemuxerStreamVector streams; + streams.push_back(audio_stream); + streams.push_back(video_stream); + + InitializeDataSource(); + InitializeDemuxer(&streams, base::TimeDelta()); + InitializeAudioDecoder(audio_stream); + InitializeAudioRenderer(); + InitializeVideoDecoder(video_stream); + InitializeVideoRenderer(); + + InitializePipeline(); + EXPECT_TRUE(pipeline_->IsInitialized()); + EXPECT_EQ(PIPELINE_OK, pipeline_->GetError()); + EXPECT_TRUE(pipeline_->IsRendered(mime_type::kMajorTypeAudio)); + EXPECT_TRUE(pipeline_->IsRendered(mime_type::kMajorTypeVideo)); + + EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(1.0f)) + .WillOnce(BroadcastMessage(mocks_->audio_renderer(), + kMsgDisableAudio)); + EXPECT_CALL(*mocks_->data_source(), + OnReceivedMessage(kMsgDisableAudio)); + EXPECT_CALL(*mocks_->demuxer(), + OnReceivedMessage(kMsgDisableAudio)); + EXPECT_CALL(*mocks_->audio_decoder(), + OnReceivedMessage(kMsgDisableAudio)); + EXPECT_CALL(*mocks_->audio_renderer(), + OnReceivedMessage(kMsgDisableAudio)); + EXPECT_CALL(*mocks_->video_decoder(), + OnReceivedMessage(kMsgDisableAudio)); + EXPECT_CALL(*mocks_->video_renderer(), + OnReceivedMessage(kMsgDisableAudio)); + + mocks_->audio_renderer()->SetPlaybackRate(1.0f); +} + } // namespace media |