Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: media/audio/clockless_audio_sink.cc

Issue 407583002: Fold AudioRenderer::Stop() into the dtor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ClocklessAudioSink Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/audio_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/clockless_audio_sink.h" 5 #include "media/audio/clockless_audio_sink.h"
6 6
7 #include "base/threading/simple_thread.h" 7 #include "base/threading/simple_thread.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "media/base/audio_renderer_sink.h" 9 #include "media/base/audio_renderer_sink.h"
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 thread_.reset(new ClocklessAudioSinkThread(params, callback)); 71 thread_.reset(new ClocklessAudioSinkThread(params, callback));
72 initialized_ = true; 72 initialized_ = true;
73 } 73 }
74 74
75 void ClocklessAudioSink::Start() { 75 void ClocklessAudioSink::Start() {
76 DCHECK(initialized_); 76 DCHECK(initialized_);
77 DCHECK(!playing_); 77 DCHECK(!playing_);
78 } 78 }
79 79
80 void ClocklessAudioSink::Stop() { 80 void ClocklessAudioSink::Stop() {
81 Pause(); 81 if (initialized_)
82 Pause();
82 } 83 }
83 84
84 void ClocklessAudioSink::Play() { 85 void ClocklessAudioSink::Play() {
85 DCHECK(initialized_); 86 DCHECK(initialized_);
86 87
87 if (playing_) 88 if (playing_)
88 return; 89 return;
89 90
90 playing_ = true; 91 playing_ = true;
91 thread_->Start(); 92 thread_->Start();
92 } 93 }
93 94
94 void ClocklessAudioSink::Pause() { 95 void ClocklessAudioSink::Pause() {
95 DCHECK(initialized_); 96 DCHECK(initialized_);
96 97
97 if (!playing_) 98 if (!playing_)
98 return; 99 return;
99 100
100 playing_ = false; 101 playing_ = false;
101 playback_time_ = thread_->Stop(); 102 playback_time_ = thread_->Stop();
102 } 103 }
103 104
104 bool ClocklessAudioSink::SetVolume(double volume) { 105 bool ClocklessAudioSink::SetVolume(double volume) {
105 // Audio is always muted. 106 // Audio is always muted.
106 return volume == 0.0; 107 return volume == 0.0;
107 } 108 }
108 109
109 } // namespace media 110 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/audio_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698