OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 11 matching lines...) Expand all Loading... | |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #ifndef TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 28 #ifndef TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
29 #define TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 29 #define TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
30 | 30 |
31 #include <map> | 31 #include <map> |
32 #include <set> | |
33 #include <string> | 32 #include <string> |
34 #include <vector> | 33 #include <vector> |
35 | 34 |
36 #include "talk/media/base/rtputils.h" | 35 #include "talk/media/base/rtputils.h" |
37 #include "talk/media/webrtc/webrtccommon.h" | 36 #include "talk/media/webrtc/webrtccommon.h" |
38 #include "talk/media/webrtc/webrtcvoe.h" | 37 #include "talk/media/webrtc/webrtcvoe.h" |
39 #include "talk/session/media/channel.h" | 38 #include "talk/session/media/channel.h" |
40 #include "webrtc/audio_state.h" | 39 #include "webrtc/audio_state.h" |
41 #include "webrtc/base/buffer.h" | 40 #include "webrtc/base/buffer.h" |
42 #include "webrtc/base/scoped_ptr.h" | 41 #include "webrtc/base/scoped_ptr.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
65 // Dependency injection for testing. | 64 // Dependency injection for testing. |
66 explicit WebRtcVoiceEngine(VoEWrapper* voe_wrapper); | 65 explicit WebRtcVoiceEngine(VoEWrapper* voe_wrapper); |
67 ~WebRtcVoiceEngine(); | 66 ~WebRtcVoiceEngine(); |
68 bool Init(rtc::Thread* worker_thread); | 67 bool Init(rtc::Thread* worker_thread); |
69 void Terminate(); | 68 void Terminate(); |
70 | 69 |
71 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const; | 70 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const; |
72 VoiceMediaChannel* CreateChannel(webrtc::Call* call, | 71 VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
73 const AudioOptions& options); | 72 const AudioOptions& options); |
74 | 73 |
75 AudioOptions GetOptions() const { return options_; } | |
76 bool SetOptions(const AudioOptions& options); | |
77 bool SetDevices(const Device* in_device, const Device* out_device); | |
78 bool GetOutputVolume(int* level); | 74 bool GetOutputVolume(int* level); |
79 bool SetOutputVolume(int level); | 75 bool SetOutputVolume(int level); |
80 int GetInputLevel(); | 76 int GetInputLevel(); |
81 | 77 |
82 const std::vector<AudioCodec>& codecs(); | 78 const std::vector<AudioCodec>& codecs(); |
83 RtpCapabilities GetCapabilities() const; | 79 RtpCapabilities GetCapabilities() const; |
84 | 80 |
85 // For tracking WebRtc channels. Needed because we have to pause them | 81 // For tracking WebRtc channels. Needed because we have to pause them |
86 // all when switching devices. | 82 // all when switching devices. |
87 // May only be called by WebRtcVoiceMediaChannel. | 83 // May only be called by WebRtcVoiceMediaChannel. |
(...skipping 23 matching lines...) Expand all Loading... | |
111 // Stops recording the RtcEventLog. | 107 // Stops recording the RtcEventLog. |
112 void StopRtcEventLog(); | 108 void StopRtcEventLog(); |
113 | 109 |
114 private: | 110 private: |
115 void Construct(); | 111 void Construct(); |
116 bool InitInternal(); | 112 bool InitInternal(); |
117 // Every option that is "set" will be applied. Every option not "set" will be | 113 // Every option that is "set" will be applied. Every option not "set" will be |
118 // ignored. This allows us to selectively turn on and off different options | 114 // ignored. This allows us to selectively turn on and off different options |
119 // easily at any time. | 115 // easily at any time. |
120 bool ApplyOptions(const AudioOptions& options); | 116 bool ApplyOptions(const AudioOptions& options); |
117 void SetDefaultDevices(); | |
121 | 118 |
122 // webrtc::TraceCallback: | 119 // webrtc::TraceCallback: |
123 void Print(webrtc::TraceLevel level, const char* trace, int length) override; | 120 void Print(webrtc::TraceLevel level, const char* trace, int length) override; |
124 | 121 |
125 // Given the device type, name, and id, find device id. Return true and | |
126 // set the output parameter rtc_id if successful. | |
127 bool FindWebRtcAudioDeviceId( | |
128 bool is_input, const std::string& dev_name, int dev_id, int* rtc_id); | |
129 | |
130 void StartAecDump(const std::string& filename); | 122 void StartAecDump(const std::string& filename); |
131 int CreateVoEChannel(); | 123 int CreateVoEChannel(); |
132 | 124 |
133 rtc::ThreadChecker signal_thread_checker_; | 125 rtc::ThreadChecker signal_thread_checker_; |
134 rtc::ThreadChecker worker_thread_checker_; | 126 rtc::ThreadChecker worker_thread_checker_; |
135 | 127 |
136 // The primary instance of WebRtc VoiceEngine. | 128 // The primary instance of WebRtc VoiceEngine. |
137 rtc::scoped_ptr<VoEWrapper> voe_wrapper_; | 129 rtc::scoped_ptr<VoEWrapper> voe_wrapper_; |
138 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 130 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
139 // The external audio device manager | 131 // The external audio device manager |
140 webrtc::AudioDeviceModule* adm_ = nullptr; | 132 webrtc::AudioDeviceModule* adm_ = nullptr; |
141 bool is_dumping_aec_ = false; | 133 bool is_dumping_aec_ = false; |
142 std::vector<AudioCodec> codecs_; | 134 std::vector<AudioCodec> codecs_; |
143 std::vector<WebRtcVoiceMediaChannel*> channels_; | 135 std::vector<WebRtcVoiceMediaChannel*> channels_; |
136 webrtc::Config voe_config_; | |
137 bool initialized_ = false; | |
tommi
2015/12/08 09:06:03
nit: could group together with is_dumping_aec for
the sun
2015/12/08 10:21:08
Done.
| |
138 | |
144 webrtc::AgcConfig default_agc_config_; | 139 webrtc::AgcConfig default_agc_config_; |
145 | |
146 webrtc::Config voe_config_; | |
147 | |
148 bool initialized_ = false; | |
149 AudioOptions options_; | |
150 | |
151 // Cache received extended_filter_aec, delay_agnostic_aec and experimental_ns | 140 // Cache received extended_filter_aec, delay_agnostic_aec and experimental_ns |
152 // values, and apply them in case they are missing in the audio options. We | 141 // values, and apply them in case they are missing in the audio options. We |
153 // need to do this because SetExtraOptions() will revert to defaults for | 142 // need to do this because SetExtraOptions() will revert to defaults for |
154 // options which are not provided. | 143 // options which are not provided. |
155 rtc::Optional<bool> extended_filter_aec_; | 144 rtc::Optional<bool> extended_filter_aec_; |
156 rtc::Optional<bool> delay_agnostic_aec_; | 145 rtc::Optional<bool> delay_agnostic_aec_; |
157 rtc::Optional<bool> experimental_ns_; | 146 rtc::Optional<bool> experimental_ns_; |
158 | 147 |
159 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcVoiceEngine); | 148 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcVoiceEngine); |
160 }; | 149 }; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 | 276 |
288 class WebRtcAudioReceiveStream; | 277 class WebRtcAudioReceiveStream; |
289 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_; | 278 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_; |
290 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 279 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
291 | 280 |
292 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); | 281 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); |
293 }; | 282 }; |
294 } // namespace cricket | 283 } // namespace cricket |
295 | 284 |
296 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 285 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
OLD | NEW |