blob: cce636869fc4a480a85d352b48875e44c1f28ee2 [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
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000014#include "webrtc/modules/audio_device/include/audio_device.h"
15#include "webrtc/modules/audio_processing/include/audio_processing.h"
16#include "webrtc/modules/utility/interface/process_thread.h"
17#include "webrtc/system_wrappers/interface/scoped_ptr.h"
18#include "webrtc/voice_engine/channel_manager.h"
19#include "webrtc/voice_engine/statistics.h"
20#include "webrtc/voice_engine/voice_engine_defines.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000021
22class ProcessThread;
23
24namespace webrtc {
25class CriticalSectionWrapper;
26
27namespace voe {
28
29class TransmitMixer;
30class OutputMixer;
niklase@google.com470e71d2011-07-07 08:21:25 +000031
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000032class SharedData
niklase@google.com470e71d2011-07-07 08:21:25 +000033{
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000034public:
35 // Public accessors.
36 WebRtc_UWord32 instance_id() const { return _instanceId; }
37 Statistics& statistics() { return _engineStatistics; }
38 ChannelManager& channel_manager() { return _channelManager; }
39 AudioDeviceModule* audio_device() { return _audioDevicePtr; }
tommi@webrtc.org851becd2012-04-04 14:57:19 +000040 void set_audio_device(AudioDeviceModule* audio_device);
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000041 AudioProcessing* audio_processing() { return audioproc_.get(); }
tommi@webrtc.org851becd2012-04-04 14:57:19 +000042 void set_audio_processing(AudioProcessing* audio_processing);
43 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; }
44 OutputMixer* output_mixer() { return _outputMixerPtr; }
45 CriticalSectionWrapper* crit_sec() { return _apiCritPtr; }
46 bool ext_recording() const { return _externalRecording; }
47 void set_ext_recording(bool value) { _externalRecording = value; }
48 bool ext_playout() const { return _externalPlayout; }
49 void set_ext_playout(bool value) { _externalPlayout = value; }
50 ProcessThread* process_thread() { return _moduleProcessThreadPtr; }
51 AudioDeviceModule::AudioLayer audio_device_layer() const {
52 return _audioDeviceLayer;
53 }
54 void set_audio_device_layer(AudioDeviceModule::AudioLayer layer) {
55 _audioDeviceLayer = layer;
56 }
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000057
niklase@google.com470e71d2011-07-07 08:21:25 +000058 WebRtc_UWord16 NumOfSendingChannels();
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000059
tommi@webrtc.org851becd2012-04-04 14:57:19 +000060 // Convenience methods for calling statistics().SetLastError().
61 void SetLastError(const WebRtc_Word32 error) const;
62 void SetLastError(const WebRtc_Word32 error, const TraceLevel level) const;
63 void SetLastError(const WebRtc_Word32 error, const TraceLevel level,
64 const char* msg) const;
65
niklase@google.com470e71d2011-07-07 08:21:25 +000066protected:
67 const WebRtc_UWord32 _instanceId;
68 CriticalSectionWrapper* _apiCritPtr;
69 ChannelManager _channelManager;
70 Statistics _engineStatistics;
niklase@google.com470e71d2011-07-07 08:21:25 +000071 AudioDeviceModule* _audioDevicePtr;
72 OutputMixer* _outputMixerPtr;
73 TransmitMixer* _transmitMixerPtr;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000074 scoped_ptr<AudioProcessing> audioproc_;
niklase@google.com470e71d2011-07-07 08:21:25 +000075 ProcessThread* _moduleProcessThreadPtr;
76
niklase@google.com470e71d2011-07-07 08:21:25 +000077 bool _externalRecording;
78 bool _externalPlayout;
79
80 AudioDeviceModule::AudioLayer _audioDeviceLayer;
81
niklase@google.com470e71d2011-07-07 08:21:25 +000082 SharedData();
83 virtual ~SharedData();
84};
85
86} // namespace voe
87
88} // namespace webrtc
89#endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H