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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 bool initialized_; | 165 bool initialized_; |
166 AudioOptions options_; | 166 AudioOptions options_; |
167 | 167 |
168 // Cache received extended_filter_aec, delay_agnostic_aec and experimental_ns | 168 // Cache received extended_filter_aec, delay_agnostic_aec and experimental_ns |
169 // values, and apply them in case they are missing in the audio options. We | 169 // values, and apply them in case they are missing in the audio options. We |
170 // need to do this because SetExtraOptions() will revert to defaults for | 170 // need to do this because SetExtraOptions() will revert to defaults for |
171 // options which are not provided. | 171 // options which are not provided. |
172 Settable<bool> extended_filter_aec_; | 172 Settable<bool> extended_filter_aec_; |
173 Settable<bool> delay_agnostic_aec_; | 173 Settable<bool> delay_agnostic_aec_; |
174 Settable<bool> experimental_ns_; | 174 Settable<bool> experimental_ns_; |
| 175 |
| 176 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcVoiceEngine); |
175 }; | 177 }; |
176 | 178 |
177 // WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses | 179 // WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses |
178 // WebRtc Voice Engine. | 180 // WebRtc Voice Engine. |
179 class WebRtcVoiceMediaChannel : public VoiceMediaChannel, | 181 class WebRtcVoiceMediaChannel : public VoiceMediaChannel, |
180 public webrtc::Transport { | 182 public webrtc::Transport { |
181 public: | 183 public: |
182 WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, | 184 WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, |
183 const AudioOptions& options, | 185 const AudioOptions& options, |
184 webrtc::Call* call); | 186 webrtc::Call* call); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 260 |
259 WebRtcVoiceEngine* engine() { return engine_; } | 261 WebRtcVoiceEngine* engine() { return engine_; } |
260 int GetLastEngineError() { return engine()->GetLastEngineError(); } | 262 int GetLastEngineError() { return engine()->GetLastEngineError(); } |
261 int GetOutputLevel(int channel); | 263 int GetOutputLevel(int channel); |
262 bool GetRedSendCodec(const AudioCodec& red_codec, | 264 bool GetRedSendCodec(const AudioCodec& red_codec, |
263 const std::vector<AudioCodec>& all_codecs, | 265 const std::vector<AudioCodec>& all_codecs, |
264 webrtc::CodecInst* send_codec); | 266 webrtc::CodecInst* send_codec); |
265 bool SetPlayout(int channel, bool playout); | 267 bool SetPlayout(int channel, bool playout); |
266 static Error WebRtcErrorToChannelError(int err_code); | 268 static Error WebRtcErrorToChannelError(int err_code); |
267 | 269 |
268 class WebRtcVoiceChannelRenderer; | |
269 // Map of ssrc to WebRtcVoiceChannelRenderer object. A new object of | |
270 // WebRtcVoiceChannelRenderer will be created for every new stream and | |
271 // will be destroyed when the stream goes away. | |
272 typedef std::map<uint32_t, WebRtcVoiceChannelRenderer*> ChannelMap; | |
273 typedef int (webrtc::VoERTP_RTCP::* ExtensionSetterFunction)(int, bool, | 270 typedef int (webrtc::VoERTP_RTCP::* ExtensionSetterFunction)(int, bool, |
274 unsigned char); | 271 unsigned char); |
275 | 272 |
276 void SetNack(int channel, bool nack_enabled); | 273 void SetNack(int channel, bool nack_enabled); |
277 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec); | 274 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec); |
278 bool ChangePlayout(bool playout); | 275 bool ChangePlayout(bool playout); |
279 bool ChangeSend(SendFlags send); | 276 bool ChangeSend(SendFlags send); |
280 bool ChangeSend(int channel, SendFlags send); | 277 bool ChangeSend(int channel, SendFlags send); |
281 bool ConfigureRecvChannel(int channel); | 278 bool ConfigureRecvChannel(int channel); |
282 int CreateVoEChannel(); | 279 int CreateVoEChannel(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 webrtc::Call* const call_; | 317 webrtc::Call* const call_; |
321 | 318 |
322 // SSRC of unsignalled receive stream, or -1 if there isn't one. | 319 // SSRC of unsignalled receive stream, or -1 if there isn't one. |
323 int64_t default_recv_ssrc_ = -1; | 320 int64_t default_recv_ssrc_ = -1; |
324 // Volume for unsignalled stream, which may be set before the stream exists. | 321 // Volume for unsignalled stream, which may be set before the stream exists. |
325 double default_recv_volume_ = 1.0; | 322 double default_recv_volume_ = 1.0; |
326 // SSRC to use for RTCP receiver reports; default to 1 in case of no signaled | 323 // SSRC to use for RTCP receiver reports; default to 1 in case of no signaled |
327 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740 | 324 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740 |
328 uint32_t receiver_reports_ssrc_ = 1; | 325 uint32_t receiver_reports_ssrc_ = 1; |
329 | 326 |
330 // send_channels_ contains the channels which are being used for sending. | 327 class WebRtcAudioSendStream; |
331 // When the default channel (default_send_channel_id) is used for sending, it | 328 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_; |
332 // is contained in send_channels_, otherwise not. | |
333 ChannelMap send_channels_; | |
334 std::vector<RtpHeaderExtension> send_extensions_; | 329 std::vector<RtpHeaderExtension> send_extensions_; |
335 ChannelMap receive_channels_; | 330 |
| 331 class WebRtcAudioReceiveStream; |
| 332 std::map<uint32_t, WebRtcAudioReceiveStream*> receive_channels_; |
336 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_; | 333 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_; |
337 std::map<uint32_t, StreamParams> receive_stream_params_; | 334 std::map<uint32_t, StreamParams> receive_stream_params_; |
338 // receive_channels_ can be read from WebRtc callback thread. Access from | 335 // receive_channels_ can be read from WebRtc callback thread. Access from |
339 // the WebRtc thread must be synchronized with edits on the worker thread. | 336 // the WebRtc thread must be synchronized with edits on the worker thread. |
340 // Reads on the worker thread are ok. | 337 // Reads on the worker thread are ok. |
341 std::vector<RtpHeaderExtension> receive_extensions_; | 338 std::vector<RtpHeaderExtension> receive_extensions_; |
342 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 339 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
| 340 |
| 341 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); |
343 }; | 342 }; |
344 | 343 |
345 } // namespace cricket | 344 } // namespace cricket |
346 | 345 |
347 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 346 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
OLD | NEW |