| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ | 68 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ |
| 69 #define CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ | 69 #define CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ |
| 70 #pragma once | 70 #pragma once |
| 71 | 71 |
| 72 #include <vector> | 72 #include <vector> |
| 73 | 73 |
| 74 #include "base/basictypes.h" | 74 #include "base/basictypes.h" |
| 75 #include "base/memory/scoped_ptr.h" | 75 #include "base/memory/scoped_ptr.h" |
| 76 #include "base/shared_memory.h" | 76 #include "base/shared_memory.h" |
| 77 #include "base/threading/simple_thread.h" | 77 #include "base/threading/simple_thread.h" |
| 78 #include "content/common/content_export.h" |
| 78 #include "content/renderer/media/audio_input_message_filter.h" | 79 #include "content/renderer/media/audio_input_message_filter.h" |
| 79 #include "media/audio/audio_parameters.h" | 80 #include "media/audio/audio_parameters.h" |
| 80 | 81 |
| 81 // 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 |
| 82 // many components in common. Investigate potential for re-factoring. | 83 // many components in common. Investigate potential for re-factoring. |
| 83 // TODO(henrika): Add support for event handling (e.g. OnStateChanged, | 84 // TODO(henrika): Add support for event handling (e.g. OnStateChanged, |
| 84 // OnCaptureStopped etc.) and ensure that we can deliver these notifications | 85 // OnCaptureStopped etc.) and ensure that we can deliver these notifications |
| 85 // to any clients using this class. | 86 // to any clients using this class. |
| 86 class AudioInputDevice | 87 class CONTENT_EXPORT AudioInputDevice |
| 87 : public AudioInputMessageFilter::Delegate, | 88 : public AudioInputMessageFilter::Delegate, |
| 88 public base::DelegateSimpleThread::Delegate, | 89 public base::DelegateSimpleThread::Delegate, |
| 89 public base::RefCountedThreadSafe<AudioInputDevice> { | 90 public base::RefCountedThreadSafe<AudioInputDevice> { |
| 90 public: | 91 public: |
| 91 class CaptureCallback { | 92 class CaptureCallback { |
| 92 public: | 93 public: |
| 93 virtual void Capture(const std::vector<float*>& audio_data, | 94 virtual void Capture(const std::vector<float*>& audio_data, |
| 94 size_t number_of_frames, | 95 size_t number_of_frames, |
| 95 size_t audio_delay_milliseconds) = 0; | 96 size_t audio_delay_milliseconds) = 0; |
| 96 protected: | 97 protected: |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // callback. Only modified on the IO thread. | 212 // callback. Only modified on the IO thread. |
| 212 bool pending_device_ready_; | 213 bool pending_device_ready_; |
| 213 | 214 |
| 214 scoped_ptr<base::SharedMemory> shared_memory_; | 215 scoped_ptr<base::SharedMemory> shared_memory_; |
| 215 scoped_ptr<base::SyncSocket> socket_; | 216 scoped_ptr<base::SyncSocket> socket_; |
| 216 | 217 |
| 217 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); | 218 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); |
| 218 }; | 219 }; |
| 219 | 220 |
| 220 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ | 221 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ |
| OLD | NEW |