summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-22 18:26:59 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-22 18:26:59 +0000
commitfc8d6efc3f827bfd011ded6836192150d0c64ec3 (patch)
treeaf8ab314168165bd86c6bfdaa1bc7293993fe5bf /media/base
parent2d0818f2b4aff07e062c54c985a11d4b12135bfd (diff)
downloadchromium_src-fc8d6efc3f827bfd011ded6836192150d0c64ec3.zip
chromium_src-fc8d6efc3f827bfd011ded6836192150d0c64ec3.tar.gz
chromium_src-fc8d6efc3f827bfd011ded6836192150d0c64ec3.tar.bz2
Fold AudioRenderer::Stop() into the dtor.
BUG=349211 TEST=Existing tests pass. Review URL: https://codereview.chromium.org/407583002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284734 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r--media/base/audio_renderer.h6
-rw-r--r--media/base/mock_filters.h1
-rw-r--r--media/base/pipeline.cc10
-rw-r--r--media/base/pipeline_unittest.cc11
4 files changed, 6 insertions, 22 deletions
diff --git a/media/base/audio_renderer.h b/media/base/audio_renderer.h
index dc202be..3e7131c 100644
--- a/media/base/audio_renderer.h
+++ b/media/base/audio_renderer.h
@@ -23,6 +23,8 @@ class MEDIA_EXPORT AudioRenderer {
typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB;
AudioRenderer();
+
+ // Stop all operations and fire all pending callbacks.
virtual ~AudioRenderer();
// Initialize an AudioRenderer with |stream|, executing |init_cb| upon
@@ -60,10 +62,6 @@ class MEDIA_EXPORT AudioRenderer {
// Only valid to call after a successful Initialize() or Flush().
virtual void StartPlaying() = 0;
- // Stop all operations in preparation for being deleted, executing |callback|
- // when complete.
- virtual void Stop(const base::Closure& callback) = 0;
-
// Sets the output volume.
virtual void SetVolume(float volume) = 0;
diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h
index 06a6c1f..dd66e2f 100644
--- a/media/base/mock_filters.h
+++ b/media/base/mock_filters.h
@@ -149,7 +149,6 @@ class MockAudioRenderer : public AudioRenderer {
const PipelineStatusCB& error_cb));
MOCK_METHOD0(GetTimeSource, TimeSource*());
MOCK_METHOD1(Flush, void(const base::Closure& callback));
- MOCK_METHOD1(Stop, void(const base::Closure& callback));
MOCK_METHOD0(StartPlaying, void());
MOCK_METHOD1(SetVolume, void(float volume));
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc
index efe91f6..f238d66 100644
--- a/media/base/pipeline.cc
+++ b/media/base/pipeline.cc
@@ -494,6 +494,9 @@ void Pipeline::DoSeek(
void Pipeline::DoStop(const PipelineStatusCB& done_cb) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(!pending_callbacks_.get());
+
+ audio_renderer_.reset();
+
SerialRunner::Queue bound_fns;
if (demuxer_) {
@@ -501,11 +504,6 @@ void Pipeline::DoStop(const PipelineStatusCB& done_cb) {
&Demuxer::Stop, base::Unretained(demuxer_)));
}
- if (audio_renderer_) {
- bound_fns.Push(base::Bind(
- &AudioRenderer::Stop, base::Unretained(audio_renderer_.get())));
- }
-
if (video_renderer_) {
bound_fns.Push(base::Bind(
&VideoRenderer::Stop, base::Unretained(video_renderer_.get())));
@@ -522,6 +520,7 @@ void Pipeline::DoStop(const PipelineStatusCB& done_cb) {
void Pipeline::OnStopCompleted(PipelineStatus status) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, kStopping);
+ DCHECK(!audio_renderer_);
{
base::AutoLock l(lock_);
running_ = false;
@@ -530,7 +529,6 @@ void Pipeline::OnStopCompleted(PipelineStatus status) {
SetState(kStopped);
pending_callbacks_.reset();
filter_collection_.reset();
- audio_renderer_.reset();
video_renderer_.reset();
text_renderer_.reset();
demuxer_ = NULL;
diff --git a/media/base/pipeline_unittest.cc b/media/base/pipeline_unittest.cc
index 6fdb4b3a..42db189 100644
--- a/media/base/pipeline_unittest.cc
+++ b/media/base/pipeline_unittest.cc
@@ -312,9 +312,6 @@ class PipelineTest : public ::testing::Test {
if (demuxer_)
EXPECT_CALL(*demuxer_, Stop(_)).WillOnce(RunClosure<0>());
- if (audio_stream_)
- EXPECT_CALL(*audio_renderer_, Stop(_)).WillOnce(RunClosure<0>());
-
if (video_stream_)
EXPECT_CALL(*video_renderer_, Stop(_)).WillOnce(RunClosure<0>());
}
@@ -687,8 +684,6 @@ TEST_F(PipelineTest, ErrorDuringSeek) {
.WillOnce(DoAll(SetBufferingState(&audio_buffering_state_cb_,
BUFFERING_HAVE_NOTHING),
RunClosure<0>()));
- EXPECT_CALL(*audio_renderer_, Stop(_))
- .WillOnce(RunClosure<0>());
EXPECT_CALL(*demuxer_, Seek(seek_time, _))
.WillOnce(RunCallback<1>(PIPELINE_ERROR_READ));
@@ -743,8 +738,6 @@ TEST_F(PipelineTest, NoMessageDuringTearDownFromError) {
.WillOnce(DoAll(SetBufferingState(&audio_buffering_state_cb_,
BUFFERING_HAVE_NOTHING),
RunClosure<0>()));
- EXPECT_CALL(*audio_renderer_, Stop(_))
- .WillOnce(RunClosure<0>());
EXPECT_CALL(*demuxer_, Seek(seek_time, _))
.WillOnce(RunCallback<1>(PIPELINE_ERROR_READ));
@@ -966,7 +959,6 @@ class PipelineTeardownTest : public PipelineTest {
}
EXPECT_CALL(*demuxer_, Stop(_)).WillOnce(RunClosure<0>());
- EXPECT_CALL(*audio_renderer_, Stop(_)).WillOnce(RunClosure<0>());
return status;
}
@@ -987,7 +979,6 @@ class PipelineTeardownTest : public PipelineTest {
}
EXPECT_CALL(*demuxer_, Stop(_)).WillOnce(RunClosure<0>());
- EXPECT_CALL(*audio_renderer_, Stop(_)).WillOnce(RunClosure<0>());
EXPECT_CALL(*video_renderer_, Stop(_)).WillOnce(RunClosure<0>());
return status;
}
@@ -1023,7 +1014,6 @@ class PipelineTeardownTest : public PipelineTest {
PipelineStatus status = SetSeekExpectations(state, stop_or_error);
EXPECT_CALL(*demuxer_, Stop(_)).WillOnce(RunClosure<0>());
- EXPECT_CALL(*audio_renderer_, Stop(_)).WillOnce(RunClosure<0>());
EXPECT_CALL(*video_renderer_, Stop(_)).WillOnce(RunClosure<0>());
EXPECT_CALL(callbacks_, OnSeek(status));
@@ -1094,7 +1084,6 @@ class PipelineTeardownTest : public PipelineTest {
InSequence s;
EXPECT_CALL(*demuxer_, Stop(_)).WillOnce(RunClosure<0>());
- EXPECT_CALL(*audio_renderer_, Stop(_)).WillOnce(RunClosure<0>());
EXPECT_CALL(*video_renderer_, Stop(_)).WillOnce(RunClosure<0>());
switch (stop_or_error) {