blob: 7c7ad5c93bd9c2775ce5e90c5c53596672305b2b [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 {
minyue@webrtc.orge509f942013-09-12 17:03:00 +000025class Config;
niklase@google.com470e71d2011-07-07 08:21:25 +000026class 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.
pbos@webrtc.org6141e132013-04-09 10:09:10 +000037 uint32_t instance_id() const { return _instanceId; }
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000038 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);
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000042 AudioProcessing* audio_processing() { return audioproc_.get(); }
tommi@webrtc.org851becd2012-04-04 14:57:19 +000043 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
pbos@webrtc.org6141e132013-04-09 10:09:10 +000059 uint16_t 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().
pbos@webrtc.org92135212013-05-14 08:31:39 +000062 void SetLastError(int32_t error) const;
63 void SetLastError(int32_t error, TraceLevel level) const;
64 void SetLastError(int32_t error, TraceLevel level,
tommi@webrtc.org851becd2012-04-04 14:57:19 +000065 const char* msg) const;
66
niklase@google.com470e71d2011-07-07 08:21:25 +000067protected:
pbos@webrtc.org6141e132013-04-09 10:09:10 +000068 const uint32_t _instanceId;
niklase@google.com470e71d2011-07-07 08:21:25 +000069 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;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000075 scoped_ptr<AudioProcessing> audioproc_;
niklase@google.com470e71d2011-07-07 08:21:25 +000076 ProcessThread* _moduleProcessThreadPtr;
77
niklase@google.com470e71d2011-07-07 08:21:25 +000078 bool _externalRecording;
79 bool _externalPlayout;
80
81 AudioDeviceModule::AudioLayer _audioDeviceLayer;
82
minyue@webrtc.orge509f942013-09-12 17:03:00 +000083 SharedData(const Config& config);
niklase@google.com470e71d2011-07-07 08:21:25 +000084 virtual ~SharedData();
85};
86
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000087} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000088
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000089} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000090#endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H