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

Unified Diff: remoting/host/ipc_audio_capturer.cc

Issue 11761019: Tiny little refactoring of DesktopEnvironment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/ipc_audio_capturer.h ('k') | remoting/host/ipc_desktop_environment.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/ipc_audio_capturer.cc
diff --git a/remoting/host/ipc_audio_capturer.cc b/remoting/host/ipc_audio_capturer.cc
index 17c478ec286acbf39188fec7602b3478f020b6c1..51d6c769ef9598f0f031a09e346b997c8b8830ac 100644
--- a/remoting/host/ipc_audio_capturer.cc
+++ b/remoting/host/ipc_audio_capturer.cc
@@ -11,7 +11,8 @@ namespace remoting {
IpcAudioCapturer::IpcAudioCapturer(
scoped_refptr<DesktopSessionProxy> desktop_session_proxy)
- : desktop_session_proxy_(desktop_session_proxy) {
+ : desktop_session_proxy_(desktop_session_proxy),
+ started_(false) {
// The audio capturer is created on the network thread while used on the audio
// capture thread. Detach |thread_checker_| from the current thread so that it
// will re-attach to the proper thread when Start() is called for the first
@@ -20,40 +21,31 @@ IpcAudioCapturer::IpcAudioCapturer(
}
IpcAudioCapturer::~IpcAudioCapturer() {
- DCHECK(callback_.is_null());
+ DCHECK(!started_);
}
bool IpcAudioCapturer::Start(const PacketCapturedCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(callback_.is_null());
- DCHECK(!callback.is_null());
+ DCHECK(!started_);
- callback_ = callback;
- desktop_session_proxy_->StartAudioCapturer(this);
+ started_ = true;
+ desktop_session_proxy_->StartAudioCapturer(callback);
return true;
}
void IpcAudioCapturer::Stop() {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(!callback_.is_null());
+ DCHECK(started_);
desktop_session_proxy_->StopAudioCapturer();
- callback_.Reset();
+ started_ = false;
}
bool IpcAudioCapturer::IsStarted() {
DCHECK(thread_checker_.CalledOnValidThread());
- return !callback_.is_null();
-}
-
-// Called when an audio packet has been received.
-void IpcAudioCapturer::OnAudioPacket(scoped_ptr<AudioPacket> packet) {
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(!callback_.is_null());
-
- callback_.Run(packet.Pass());
+ return started_;
}
} // namespace remoting
« no previous file with comments | « remoting/host/ipc_audio_capturer.h ('k') | remoting/host/ipc_desktop_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698