| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Low-latency audio capturing unit utilizing audio input stream provided | 5 // Low-latency audio capturing unit utilizing audio input stream provided |
| 6 // by browser process through IPC. | 6 // by browser process through IPC. |
| 7 // | 7 // |
| 8 // Relationship of classes: | 8 // Relationship of classes: |
| 9 // | 9 // |
| 10 // AudioInputController AudioInputDevice | 10 // AudioInputController AudioInputDevice |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // TODO(henrika): This class is based on the AudioDevice class and it has | 82 // TODO(henrika): This class is based on the AudioDevice class and it has |
| 83 // many components in common. Investigate potential for re-factoring. | 83 // many components in common. Investigate potential for re-factoring. |
| 84 // TODO(henrika): Add support for event handling (e.g. OnStateChanged, | 84 // TODO(henrika): Add support for event handling (e.g. OnStateChanged, |
| 85 // OnCaptureStopped etc.) and ensure that we can deliver these notifications | 85 // OnCaptureStopped etc.) and ensure that we can deliver these notifications |
| 86 // to any clients using this class. | 86 // to any clients using this class. |
| 87 class CONTENT_EXPORT AudioInputDevice | 87 class CONTENT_EXPORT AudioInputDevice |
| 88 : public AudioInputMessageFilter::Delegate, | 88 : public AudioInputMessageFilter::Delegate, |
| 89 public base::DelegateSimpleThread::Delegate, | 89 public base::DelegateSimpleThread::Delegate, |
| 90 public base::RefCountedThreadSafe<AudioInputDevice> { | 90 public base::RefCountedThreadSafe<AudioInputDevice> { |
| 91 public: | 91 public: |
| 92 class CaptureCallback { | 92 class CONTENT_EXPORT CaptureCallback { |
| 93 public: | 93 public: |
| 94 virtual void Capture(const std::vector<float*>& audio_data, | 94 virtual void Capture(const std::vector<float*>& audio_data, |
| 95 size_t number_of_frames, | 95 size_t number_of_frames, |
| 96 size_t audio_delay_milliseconds) = 0; | 96 size_t audio_delay_milliseconds) = 0; |
| 97 protected: | 97 protected: |
| 98 virtual ~CaptureCallback() {} | 98 virtual ~CaptureCallback() {} |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 class CaptureEventHandler { | 101 class CONTENT_EXPORT CaptureEventHandler { |
| 102 public: | 102 public: |
| 103 // Notification to the client that the device with the specific index has | 103 // Notification to the client that the device with the specific index has |
| 104 // been started. This callback is triggered as a result of StartDevice(). | 104 // been started. This callback is triggered as a result of StartDevice(). |
| 105 virtual void OnDeviceStarted(int device_index) = 0; | 105 virtual void OnDeviceStarted(int device_index) = 0; |
| 106 | 106 |
| 107 // Notification to the client that the device has been stopped. | 107 // Notification to the client that the device has been stopped. |
| 108 virtual void OnDeviceStopped() = 0; | 108 virtual void OnDeviceStopped() = 0; |
| 109 | 109 |
| 110 protected: | 110 protected: |
| 111 virtual ~CaptureEventHandler() {} | 111 virtual ~CaptureEventHandler() {} |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // callback. Only modified on the IO thread. | 212 // callback. Only modified on the IO thread. |
| 213 bool pending_device_ready_; | 213 bool pending_device_ready_; |
| 214 | 214 |
| 215 scoped_ptr<base::SharedMemory> shared_memory_; | 215 scoped_ptr<base::SharedMemory> shared_memory_; |
| 216 scoped_ptr<base::SyncSocket> socket_; | 216 scoped_ptr<base::SyncSocket> socket_; |
| 217 | 217 |
| 218 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); | 218 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ | 221 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ |
| OLD | NEW |