blob: a4a852a4351412a3a368da911fcecaea2409040c [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
tommi@webrtc.org851becd2012-04-04 14:57:19 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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 */
10
11#ifndef WEBRTC_VOICE_ENGINE_SHARED_DATA_H
12#define WEBRTC_VOICE_ENGINE_SHARED_DATA_H
13
kwibergb7f89d62016-02-17 10:04:18 -080014#include <memory>
15
tommi31fc21f2016-01-21 10:37:37 -080016#include "webrtc/base/criticalsection.h"
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000017#include "webrtc/modules/audio_device/include/audio_device.h"
18#include "webrtc/modules/audio_processing/include/audio_processing.h"
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010019#include "webrtc/modules/utility/include/process_thread.h"
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000020#include "webrtc/voice_engine/channel_manager.h"
21#include "webrtc/voice_engine/statistics.h"
22#include "webrtc/voice_engine/voice_engine_defines.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000023
24class ProcessThread;
25
26namespace webrtc {
minyue@webrtc.orge509f942013-09-12 17:03:00 +000027class Config;
niklase@google.com470e71d2011-07-07 08:21:25 +000028
29namespace voe {
30
31class TransmitMixer;
32class OutputMixer;
niklase@google.com470e71d2011-07-07 08:21:25 +000033
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000034class SharedData
niklase@google.com470e71d2011-07-07 08:21:25 +000035{
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000036public:
37 // Public accessors.
pbos@webrtc.org6141e132013-04-09 10:09:10 +000038 uint32_t instance_id() const { return _instanceId; }
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000039 Statistics& statistics() { return _engineStatistics; }
40 ChannelManager& channel_manager() { return _channelManager; }
41 AudioDeviceModule* audio_device() { return _audioDevicePtr; }
tommi@webrtc.org851becd2012-04-04 14:57:19 +000042 void set_audio_device(AudioDeviceModule* audio_device);
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000043 AudioProcessing* audio_processing() { return audioproc_.get(); }
tommi@webrtc.org851becd2012-04-04 14:57:19 +000044 void set_audio_processing(AudioProcessing* audio_processing);
45 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; }
46 OutputMixer* output_mixer() { return _outputMixerPtr; }
tommi31fc21f2016-01-21 10:37:37 -080047 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; }
tommi@webrtc.org0c3e12b2015-02-06 09:44:12 +000048 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); }
tommi@webrtc.org851becd2012-04-04 14:57:19 +000049 AudioDeviceModule::AudioLayer audio_device_layer() const {
50 return _audioDeviceLayer;
51 }
52 void set_audio_device_layer(AudioDeviceModule::AudioLayer layer) {
53 _audioDeviceLayer = layer;
54 }
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000055
xians@webrtc.org675e2602013-10-17 16:15:34 +000056 int NumOfSendingChannels();
57 int NumOfPlayingChannels();
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000058
tommi@webrtc.org851becd2012-04-04 14:57:19 +000059 // Convenience methods for calling statistics().SetLastError().
pbos@webrtc.org92135212013-05-14 08:31:39 +000060 void SetLastError(int32_t error) const;
61 void SetLastError(int32_t error, TraceLevel level) const;
62 void SetLastError(int32_t error, TraceLevel level,
tommi@webrtc.org851becd2012-04-04 14:57:19 +000063 const char* msg) const;
64
niklase@google.com470e71d2011-07-07 08:21:25 +000065protected:
pbos@webrtc.org6141e132013-04-09 10:09:10 +000066 const uint32_t _instanceId;
pbosd8de1152016-02-01 09:00:51 -080067 rtc::CriticalSection _apiCritPtr;
niklase@google.com470e71d2011-07-07 08:21:25 +000068 ChannelManager _channelManager;
69 Statistics _engineStatistics;
niklase@google.com470e71d2011-07-07 08:21:25 +000070 AudioDeviceModule* _audioDevicePtr;
71 OutputMixer* _outputMixerPtr;
72 TransmitMixer* _transmitMixerPtr;
kwibergb7f89d62016-02-17 10:04:18 -080073 std::unique_ptr<AudioProcessing> audioproc_;
74 std::unique_ptr<ProcessThread> _moduleProcessThreadPtr;
niklase@google.com470e71d2011-07-07 08:21:25 +000075
niklase@google.com470e71d2011-07-07 08:21:25 +000076 AudioDeviceModule::AudioLayer _audioDeviceLayer;
77
minyue@webrtc.orge509f942013-09-12 17:03:00 +000078 SharedData(const Config& config);
niklase@google.com470e71d2011-07-07 08:21:25 +000079 virtual ~SharedData();
80};
81
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000082} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000083
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000084} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000085#endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H