| 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 #ifndef REMOTING_HOST_IPC_AUDIO_CAPTURER_H_ | 5 #ifndef REMOTING_HOST_IPC_AUDIO_CAPTURER_H_ |
| 6 #define REMOTING_HOST_IPC_AUDIO_CAPTURER_H_ | 6 #define REMOTING_HOST_IPC_AUDIO_CAPTURER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "remoting/host/audio_capturer.h" | 13 #include "remoting/host/audio_capturer.h" |
| 13 | 14 |
| 14 namespace remoting { | 15 namespace remoting { |
| 15 | 16 |
| 16 class AudioPacket; | 17 class AudioPacket; |
| 17 class DesktopSessionProxy; | 18 class DesktopSessionProxy; |
| 18 | 19 |
| 19 class IpcAudioCapturer : public AudioCapturer { | 20 class IpcAudioCapturer : public AudioCapturer { |
| 20 public: | 21 public: |
| 21 explicit IpcAudioCapturer( | 22 explicit IpcAudioCapturer( |
| 22 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); | 23 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); |
| 23 ~IpcAudioCapturer() override; | 24 ~IpcAudioCapturer() override; |
| 24 | 25 |
| 25 // AudioCapturer interface. | 26 // AudioCapturer interface. |
| 26 bool Start(const PacketCapturedCallback& callback) override; | 27 bool Start(const PacketCapturedCallback& callback) override; |
| 27 | 28 |
| 28 // Called by DesktopSessionProxy when an audio packet is received. | 29 // Called by DesktopSessionProxy when an audio packet is received. |
| 29 void OnAudioPacket(scoped_ptr<AudioPacket> packet); | 30 void OnAudioPacket(std::unique_ptr<AudioPacket> packet); |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 // Invoked when an audio packet was received. | 33 // Invoked when an audio packet was received. |
| 33 PacketCapturedCallback callback_; | 34 PacketCapturedCallback callback_; |
| 34 | 35 |
| 35 // Wraps the IPC channel to the desktop session agent. | 36 // Wraps the IPC channel to the desktop session agent. |
| 36 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; | 37 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; |
| 37 | 38 |
| 38 // Used to cancel tasks pending on the capturer when it is stopped. | 39 // Used to cancel tasks pending on the capturer when it is stopped. |
| 39 base::WeakPtrFactory<IpcAudioCapturer> weak_factory_; | 40 base::WeakPtrFactory<IpcAudioCapturer> weak_factory_; |
| 40 | 41 |
| 41 DISALLOW_COPY_AND_ASSIGN(IpcAudioCapturer); | 42 DISALLOW_COPY_AND_ASSIGN(IpcAudioCapturer); |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 } // namespace remoting | 45 } // namespace remoting |
| 45 | 46 |
| 46 #endif // REMOTING_HOST_IPC_AUDIO_CAPTURER_H_ | 47 #endif // REMOTING_HOST_IPC_AUDIO_CAPTURER_H_ |
| OLD | NEW |