blob: 191e369e7f63462cffd6ab8ac22b7e3a9815b0e6 [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
14#include "voice_engine_defines.h"
15
16#include "channel_manager.h"
17#include "statistics.h"
18#include "process_thread.h"
19
20#include "audio_device.h"
21#include "audio_processing.h"
22
23class ProcessThread;
24
25namespace webrtc {
26class CriticalSectionWrapper;
27
28namespace voe {
29
30class TransmitMixer;
31class OutputMixer;
niklase@google.com470e71d2011-07-07 08:21:25 +000032
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000033class SharedData
niklase@google.com470e71d2011-07-07 08:21:25 +000034{
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000035public:
36 // Public accessors.
37 WebRtc_UWord32 instance_id() const { return _instanceId; }
38 Statistics& statistics() { return _engineStatistics; }
39 ChannelManager& channel_manager() { return _channelManager; }
40 AudioDeviceModule* audio_device() { return _audioDevicePtr; }
tommi@webrtc.org851becd2012-04-04 14:57:19 +000041 void set_audio_device(AudioDeviceModule* audio_device);
42 AudioProcessing* audio_processing() { return _audioProcessingModulePtr; }
43 void set_audio_processing(AudioProcessing* audio_processing);
44 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; }
45 OutputMixer* output_mixer() { return _outputMixerPtr; }
46 CriticalSectionWrapper* crit_sec() { return _apiCritPtr; }
47 bool ext_recording() const { return _externalRecording; }
48 void set_ext_recording(bool value) { _externalRecording = value; }
49 bool ext_playout() const { return _externalPlayout; }
50 void set_ext_playout(bool value) { _externalPlayout = value; }
51 ProcessThread* process_thread() { return _moduleProcessThreadPtr; }
52 AudioDeviceModule::AudioLayer audio_device_layer() const {
53 return _audioDeviceLayer;
54 }
55 void set_audio_device_layer(AudioDeviceModule::AudioLayer layer) {
56 _audioDeviceLayer = layer;
57 }
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000058
niklase@google.com470e71d2011-07-07 08:21:25 +000059 WebRtc_UWord16 NumOfSendingChannels();
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000060
tommi@webrtc.org851becd2012-04-04 14:57:19 +000061 // Convenience methods for calling statistics().SetLastError().
62 void SetLastError(const WebRtc_Word32 error) const;
63 void SetLastError(const WebRtc_Word32 error, const TraceLevel level) const;
64 void SetLastError(const WebRtc_Word32 error, const TraceLevel level,
65 const char* msg) const;
66
niklase@google.com470e71d2011-07-07 08:21:25 +000067protected:
68 const WebRtc_UWord32 _instanceId;
69 CriticalSectionWrapper* _apiCritPtr;
70 ChannelManager _channelManager;
71 Statistics _engineStatistics;
niklase@google.com470e71d2011-07-07 08:21:25 +000072 AudioDeviceModule* _audioDevicePtr;
73 OutputMixer* _outputMixerPtr;
74 TransmitMixer* _transmitMixerPtr;
75 AudioProcessing* _audioProcessingModulePtr;
76 ProcessThread* _moduleProcessThreadPtr;
77
niklase@google.com470e71d2011-07-07 08:21:25 +000078 bool _externalRecording;
79 bool _externalPlayout;
80
81 AudioDeviceModule::AudioLayer _audioDeviceLayer;
82
niklase@google.com470e71d2011-07-07 08:21:25 +000083 SharedData();
84 virtual ~SharedData();
85};
86
87} // namespace voe
88
89} // namespace webrtc
90#endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H