| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "remoting/host/ipc_audio_capturer.h" | 5 #include "remoting/host/ipc_audio_capturer.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "remoting/host/desktop_session_proxy.h" | 9 #include "remoting/host/desktop_session_proxy.h" |
| 8 #include "remoting/proto/audio.pb.h" | 10 #include "remoting/proto/audio.pb.h" |
| 9 | 11 |
| 10 namespace remoting { | 12 namespace remoting { |
| 11 | 13 |
| 12 IpcAudioCapturer::IpcAudioCapturer( | 14 IpcAudioCapturer::IpcAudioCapturer( |
| 13 scoped_refptr<DesktopSessionProxy> desktop_session_proxy) | 15 scoped_refptr<DesktopSessionProxy> desktop_session_proxy) |
| 14 : desktop_session_proxy_(desktop_session_proxy), | 16 : desktop_session_proxy_(desktop_session_proxy), |
| 15 weak_factory_(this) { | 17 weak_factory_(this) { |
| 16 } | 18 } |
| 17 | 19 |
| 18 IpcAudioCapturer::~IpcAudioCapturer() { | 20 IpcAudioCapturer::~IpcAudioCapturer() { |
| 19 } | 21 } |
| 20 | 22 |
| 21 bool IpcAudioCapturer::Start(const PacketCapturedCallback& callback) { | 23 bool IpcAudioCapturer::Start(const PacketCapturedCallback& callback) { |
| 22 DCHECK(callback_.is_null()); | 24 DCHECK(callback_.is_null()); |
| 23 DCHECK(!callback.is_null()); | 25 DCHECK(!callback.is_null()); |
| 24 | 26 |
| 25 callback_ = callback; | 27 callback_ = callback; |
| 26 desktop_session_proxy_->SetAudioCapturer(weak_factory_.GetWeakPtr()); | 28 desktop_session_proxy_->SetAudioCapturer(weak_factory_.GetWeakPtr()); |
| 27 return true; | 29 return true; |
| 28 } | 30 } |
| 29 | 31 |
| 30 void IpcAudioCapturer::OnAudioPacket(scoped_ptr<AudioPacket> packet) { | 32 void IpcAudioCapturer::OnAudioPacket(scoped_ptr<AudioPacket> packet) { |
| 31 callback_.Run(packet.Pass()); | 33 callback_.Run(std::move(packet)); |
| 32 } | 34 } |
| 33 | 35 |
| 34 } // namespace remoting | 36 } // namespace remoting |
| OLD | NEW |