OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 { | 31 { |
32 class EventWrapper; | 32 class EventWrapper; |
33 | 33 |
34 const uint32_t N_REC_SAMPLES_PER_SEC = 48000; | 34 const uint32_t N_REC_SAMPLES_PER_SEC = 48000; |
35 const uint32_t N_PLAY_SAMPLES_PER_SEC = 48000; | 35 const uint32_t N_PLAY_SAMPLES_PER_SEC = 48000; |
36 | 36 |
37 const uint32_t N_REC_CHANNELS = 1; // default is mono recording | 37 const uint32_t N_REC_CHANNELS = 1; // default is mono recording |
38 const uint32_t N_PLAY_CHANNELS = 2; // default is stereo playout | 38 const uint32_t N_PLAY_CHANNELS = 2; // default is stereo playout |
39 const uint32_t N_DEVICE_CHANNELS = 64; | 39 const uint32_t N_DEVICE_CHANNELS = 64; |
40 | 40 |
41 const uint32_t ENGINE_REC_BUF_SIZE_IN_SAMPLES = (N_REC_SAMPLES_PER_SEC / 100); | 41 const int kBufferSizeMs = 10; |
42 const uint32_t ENGINE_PLAY_BUF_SIZE_IN_SAMPLES = (N_PLAY_SAMPLES_PER_SEC / 100); | 42 |
| 43 const uint32_t ENGINE_REC_BUF_SIZE_IN_SAMPLES = |
| 44 N_REC_SAMPLES_PER_SEC * kBufferSizeMs / 1000; |
| 45 const uint32_t ENGINE_PLAY_BUF_SIZE_IN_SAMPLES = |
| 46 N_PLAY_SAMPLES_PER_SEC * kBufferSizeMs / 1000; |
43 | 47 |
44 const int N_BLOCKS_IO = 2; | 48 const int N_BLOCKS_IO = 2; |
45 const int N_BUFFERS_IN = 2; // Must be at least N_BLOCKS_IO. | 49 const int N_BUFFERS_IN = 2; // Must be at least N_BLOCKS_IO. |
46 const int N_BUFFERS_OUT = 3; // Must be at least N_BLOCKS_IO. | 50 const int N_BUFFERS_OUT = 3; // Must be at least N_BLOCKS_IO. |
47 | 51 |
48 const uint32_t TIMER_PERIOD_MS = (2 * 10 * N_BLOCKS_IO * 1000000); | 52 const uint32_t TIMER_PERIOD_MS = 2 * 10 * N_BLOCKS_IO * 1000000; |
49 | 53 |
50 const uint32_t REC_BUF_SIZE_IN_SAMPLES = | 54 const uint32_t REC_BUF_SIZE_IN_SAMPLES = |
51 ENGINE_REC_BUF_SIZE_IN_SAMPLES * N_DEVICE_CHANNELS * N_BUFFERS_IN; | 55 ENGINE_REC_BUF_SIZE_IN_SAMPLES * N_DEVICE_CHANNELS * N_BUFFERS_IN; |
52 const uint32_t PLAY_BUF_SIZE_IN_SAMPLES = | 56 const uint32_t PLAY_BUF_SIZE_IN_SAMPLES = |
53 ENGINE_PLAY_BUF_SIZE_IN_SAMPLES * N_PLAY_CHANNELS * N_BUFFERS_OUT; | 57 ENGINE_PLAY_BUF_SIZE_IN_SAMPLES * N_PLAY_CHANNELS * N_BUFFERS_OUT; |
54 | 58 |
| 59 const int kGetMicVolumeIntervalMs = 1000; |
| 60 |
55 class AudioDeviceMac: public AudioDeviceGeneric | 61 class AudioDeviceMac: public AudioDeviceGeneric |
56 { | 62 { |
57 public: | 63 public: |
58 AudioDeviceMac(const int32_t id); | 64 AudioDeviceMac(const int32_t id); |
59 ~AudioDeviceMac(); | 65 ~AudioDeviceMac(); |
60 | 66 |
61 // Retrieve the currently utilized audio layer | 67 // Retrieve the currently utilized audio layer |
62 virtual int32_t | 68 virtual int32_t |
63 ActiveAudioLayer(AudioDeviceModule::AudioLayer& audioLayer) const; | 69 ActiveAudioLayer(AudioDeviceModule::AudioLayer& audioLayer) const; |
64 | 70 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 371 |
366 semaphore_t _renderSemaphore; | 372 semaphore_t _renderSemaphore; |
367 semaphore_t _captureSemaphore; | 373 semaphore_t _captureSemaphore; |
368 | 374 |
369 int _captureBufSizeSamples; | 375 int _captureBufSizeSamples; |
370 int _renderBufSizeSamples; | 376 int _renderBufSizeSamples; |
371 | 377 |
372 // Typing detection | 378 // Typing detection |
373 // 0x5c is key "9", after that comes function keys. | 379 // 0x5c is key "9", after that comes function keys. |
374 bool prev_key_state_[0x5d]; | 380 bool prev_key_state_[0x5d]; |
| 381 |
| 382 int get_mic_volume_counter_ms_; |
375 }; | 383 }; |
376 | 384 |
377 } // namespace webrtc | 385 } // namespace webrtc |
378 | 386 |
379 #endif // MODULES_AUDIO_DEVICE_MAIN_SOURCE_MAC_AUDIO_DEVICE_MAC_H_ | 387 #endif // MODULES_AUDIO_DEVICE_MAIN_SOURCE_MAC_AUDIO_DEVICE_MAC_H_ |
OLD | NEW |