1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "remoting/host/ipc_audio_capturer.h"
7 #include "remoting/host/desktop_session_proxy.h"
8 #include "remoting/proto/audio.pb.h"
12 IpcAudioCapturer::IpcAudioCapturer(
13 scoped_refptr<DesktopSessionProxy> desktop_session_proxy)
14 : desktop_session_proxy_(desktop_session_proxy),
18 IpcAudioCapturer::~IpcAudioCapturer() {
21 bool IpcAudioCapturer::Start(const PacketCapturedCallback& callback) {
22 DCHECK(callback_.is_null());
23 DCHECK(!callback.is_null());
26 desktop_session_proxy_->SetAudioCapturer(weak_factory_.GetWeakPtr());
30 void IpcAudioCapturer::Stop() {
32 weak_factory_.InvalidateWeakPtrs();
35 bool IpcAudioCapturer::IsStarted() {
36 return !callback_.is_null();
39 void IpcAudioCapturer::OnAudioPacket(scoped_ptr<AudioPacket> packet) {
40 callback_.Run(packet.Pass());
43 } // namespace remoting