solenberg | b0f22c5 | 2015-11-06 23:34:49 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
ossu | 31212ba | 2016-12-07 12:52:58 | [diff] [blame] | 10 | #ifndef WEBRTC_CALL_AUDIO_STATE_H_ |
| 11 | #define WEBRTC_CALL_AUDIO_STATE_H_ |
solenberg | b0f22c5 | 2015-11-06 23:34:49 | [diff] [blame] | 12 | |
aleloi | f5f9419 | 2016-11-08 12:26:30 | [diff] [blame] | 13 | #include "webrtc/api/audio/audio_mixer.h" |
Edward Lemur | 76de83e | 2017-07-06 17:44:34 | [diff] [blame] | 14 | #include "webrtc/rtc_base/refcount.h" |
| 15 | #include "webrtc/rtc_base/scoped_ref_ptr.h" |
solenberg | b0f22c5 | 2015-11-06 23:34:49 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
peah | 588f761 | 2017-06-29 15:32:09 | [diff] [blame] | 19 | class AudioProcessing; |
solenberg | b0f22c5 | 2015-11-06 23:34:49 | [diff] [blame] | 20 | class VoiceEngine; |
| 21 | |
Fredrik Solenberg | f1f7cbb | 2015-12-03 12:06:20 | [diff] [blame] | 22 | // WORK IN PROGRESS |
| 23 | // This class is under development and is not yet intended for for use outside |
| 24 | // of WebRtc/Libjingle. Please use the VoiceEngine API instead. |
| 25 | // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690 |
| 26 | |
solenberg | b0f22c5 | 2015-11-06 23:34:49 | [diff] [blame] | 27 | // AudioState holds the state which must be shared between multiple instances of |
| 28 | // webrtc::Call for audio processing purposes. |
| 29 | class AudioState : public rtc::RefCountInterface { |
| 30 | public: |
| 31 | struct Config { |
| 32 | // VoiceEngine used for audio streams and audio/video synchronization. |
| 33 | // AudioState will tickle the VoE refcount to keep it alive for as long as |
| 34 | // the AudioState itself. |
| 35 | VoiceEngine* voice_engine = nullptr; |
| 36 | |
aleloi | f5f9419 | 2016-11-08 12:26:30 | [diff] [blame] | 37 | // The audio mixer connected to active receive streams. One per |
| 38 | // AudioState. |
| 39 | rtc::scoped_refptr<AudioMixer> audio_mixer; |
peah | 588f761 | 2017-06-29 15:32:09 | [diff] [blame] | 40 | |
| 41 | // The audio processing module. |
| 42 | rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing; |
solenberg | b0f22c5 | 2015-11-06 23:34:49 | [diff] [blame] | 43 | }; |
| 44 | |
peah | 588f761 | 2017-06-29 15:32:09 | [diff] [blame] | 45 | virtual AudioProcessing* audio_processing() = 0; |
| 46 | |
solenberg | b0f22c5 | 2015-11-06 23:34:49 | [diff] [blame] | 47 | // TODO(solenberg): Replace scoped_refptr with shared_ptr once we can use it. |
| 48 | static rtc::scoped_refptr<AudioState> Create( |
| 49 | const AudioState::Config& config); |
| 50 | |
| 51 | virtual ~AudioState() {} |
| 52 | }; |
| 53 | } // namespace webrtc |
| 54 | |
ossu | 31212ba | 2016-12-07 12:52:58 | [diff] [blame] | 55 | #endif // WEBRTC_CALL_AUDIO_STATE_H_ |