2015-11-06 15:34:49 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef AUDIO_AUDIO_STATE_H_
|
|
|
|
|
#define AUDIO_AUDIO_STATE_H_
|
2015-11-06 15:34:49 -08:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "audio/audio_transport_proxy.h"
|
|
|
|
|
#include "audio/scoped_voe_interface.h"
|
|
|
|
|
#include "call/audio_state.h"
|
|
|
|
|
#include "rtc_base/constructormagic.h"
|
|
|
|
|
#include "rtc_base/criticalsection.h"
|
2017-10-19 13:15:17 +02:00
|
|
|
#include "rtc_base/refcount.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/thread_checker.h"
|
|
|
|
|
#include "voice_engine/include/voe_base.h"
|
2015-11-06 15:34:49 -08:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace internal {
|
|
|
|
|
|
2017-09-26 09:35:01 -07:00
|
|
|
class AudioState final : public webrtc::AudioState {
|
2015-11-06 15:34:49 -08:00
|
|
|
public:
|
|
|
|
|
explicit AudioState(const AudioState::Config& config);
|
|
|
|
|
~AudioState() override;
|
|
|
|
|
|
2017-06-29 08:32:09 -07:00
|
|
|
AudioProcessing* audio_processing() override {
|
2017-07-07 04:25:11 -07:00
|
|
|
RTC_DCHECK(config_.audio_processing);
|
|
|
|
|
return config_.audio_processing.get();
|
2017-06-29 08:32:09 -07:00
|
|
|
}
|
2016-11-17 06:28:59 -08:00
|
|
|
|
2017-06-29 08:32:09 -07:00
|
|
|
VoiceEngine* voice_engine();
|
2016-11-17 06:28:59 -08:00
|
|
|
rtc::scoped_refptr<AudioMixer> mixer();
|
2015-11-06 15:34:49 -08:00
|
|
|
bool typing_noise_detected() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// rtc::RefCountInterface implementation.
|
2017-10-19 13:15:17 +02:00
|
|
|
void AddRef() const override;
|
|
|
|
|
rtc::RefCountReleaseStatus Release() const override;
|
2015-11-06 15:34:49 -08:00
|
|
|
|
|
|
|
|
rtc::ThreadChecker thread_checker_;
|
|
|
|
|
rtc::ThreadChecker process_thread_checker_;
|
|
|
|
|
const webrtc::AudioState::Config config_;
|
|
|
|
|
|
|
|
|
|
// We hold one interface pointer to the VoE to make sure it is kept alive.
|
|
|
|
|
ScopedVoEInterface<VoEBase> voe_base_;
|
|
|
|
|
|
|
|
|
|
// Reference count; implementation copied from rtc::RefCountedObject.
|
|
|
|
|
mutable volatile int ref_count_ = 0;
|
|
|
|
|
|
2016-11-17 06:28:59 -08:00
|
|
|
// Transports mixed audio from the mixer to the audio device and
|
|
|
|
|
// recorded audio to the VoE AudioTransport.
|
|
|
|
|
AudioTransportProxy audio_transport_proxy_;
|
|
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioState);
|
|
|
|
|
};
|
|
|
|
|
} // namespace internal
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // AUDIO_AUDIO_STATE_H_
|