Line data Source code
1 : /*
2 : * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 : *
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 <memory>
15 :
16 : #include "webrtc/base/criticalsection.h"
17 : #include "webrtc/base/scoped_ref_ptr.h"
18 : #include "webrtc/modules/audio_device/include/audio_device.h"
19 : #include "webrtc/modules/audio_processing/include/audio_processing.h"
20 : #include "webrtc/modules/utility/include/process_thread.h"
21 : #include "webrtc/voice_engine/channel_manager.h"
22 : #include "webrtc/voice_engine/statistics.h"
23 : #include "webrtc/voice_engine/voice_engine_defines.h"
24 :
25 : class ProcessThread;
26 :
27 : namespace webrtc {
28 : namespace voe {
29 :
30 : class TransmitMixer;
31 : class OutputMixer;
32 :
33 : class SharedData
34 : {
35 : public:
36 : // Public accessors.
37 0 : uint32_t instance_id() const { return _instanceId; }
38 0 : Statistics& statistics() { return _engineStatistics; }
39 0 : ChannelManager& channel_manager() { return _channelManager; }
40 0 : AudioDeviceModule* audio_device() { return _audioDevicePtr.get(); }
41 : void set_audio_device(
42 : const rtc::scoped_refptr<AudioDeviceModule>& audio_device);
43 0 : AudioProcessing* audio_processing() { return audioproc_.get(); }
44 : void set_audio_processing(AudioProcessing* audio_processing);
45 0 : TransmitMixer* transmit_mixer() { return _transmitMixerPtr; }
46 0 : OutputMixer* output_mixer() { return _outputMixerPtr; }
47 0 : rtc::CriticalSection* crit_sec() { return &_apiCritPtr; }
48 0 : bool ext_recording() const { return _externalRecording; }
49 0 : void set_ext_recording(bool value) { _externalRecording = value; }
50 0 : bool ext_playout() const { return _externalPlayout; }
51 0 : void set_ext_playout(bool value) { _externalPlayout = value; }
52 0 : ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); }
53 0 : AudioDeviceModule::AudioLayer audio_device_layer() const {
54 0 : return _audioDeviceLayer;
55 : }
56 0 : void set_audio_device_layer(AudioDeviceModule::AudioLayer layer) {
57 0 : _audioDeviceLayer = layer;
58 0 : }
59 :
60 : int NumOfSendingChannels();
61 : int NumOfPlayingChannels();
62 :
63 : // Convenience methods for calling statistics().SetLastError().
64 : void SetLastError(int32_t error) const;
65 : void SetLastError(int32_t error, TraceLevel level) const;
66 : void SetLastError(int32_t error, TraceLevel level,
67 : const char* msg) const;
68 :
69 : protected:
70 : const uint32_t _instanceId;
71 : rtc::CriticalSection _apiCritPtr;
72 : ChannelManager _channelManager;
73 : Statistics _engineStatistics;
74 : rtc::scoped_refptr<AudioDeviceModule> _audioDevicePtr;
75 : OutputMixer* _outputMixerPtr;
76 : TransmitMixer* _transmitMixerPtr;
77 : std::unique_ptr<AudioProcessing> audioproc_;
78 : std::unique_ptr<ProcessThread> _moduleProcessThreadPtr;
79 :
80 : bool _externalRecording;
81 : bool _externalPlayout;
82 :
83 : AudioDeviceModule::AudioLayer _audioDeviceLayer;
84 :
85 : SharedData();
86 : virtual ~SharedData();
87 : };
88 :
89 : } // namespace voe
90 : } // namespace webrtc
91 : #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H
|