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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer); | 252 bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer); |
253 bool MuteStream(uint32 ssrc, bool mute); | 253 bool MuteStream(uint32 ssrc, bool mute); |
254 | 254 |
255 WebRtcVoiceEngine* engine() { return engine_; } | 255 WebRtcVoiceEngine* engine() { return engine_; } |
256 int GetLastEngineError() { return engine()->GetLastEngineError(); } | 256 int GetLastEngineError() { return engine()->GetLastEngineError(); } |
257 int GetOutputLevel(int channel); | 257 int GetOutputLevel(int channel); |
258 bool GetRedSendCodec(const AudioCodec& red_codec, | 258 bool GetRedSendCodec(const AudioCodec& red_codec, |
259 const std::vector<AudioCodec>& all_codecs, | 259 const std::vector<AudioCodec>& all_codecs, |
260 webrtc::CodecInst* send_codec); | 260 webrtc::CodecInst* send_codec); |
261 bool EnableRtcp(int channel); | 261 bool EnableRtcp(int channel); |
262 bool ResetRecvCodecs(int channel); | |
263 bool SetPlayout(int channel, bool playout); | 262 bool SetPlayout(int channel, bool playout); |
264 static uint32 ParseSsrc(const void* data, size_t len, bool rtcp); | |
265 static Error WebRtcErrorToChannelError(int err_code); | 263 static Error WebRtcErrorToChannelError(int err_code); |
266 | 264 |
267 class WebRtcVoiceChannelRenderer; | 265 class WebRtcVoiceChannelRenderer; |
268 // Map of ssrc to WebRtcVoiceChannelRenderer object. A new object of | 266 // Map of ssrc to WebRtcVoiceChannelRenderer object. A new object of |
269 // WebRtcVoiceChannelRenderer will be created for every new stream and | 267 // WebRtcVoiceChannelRenderer will be created for every new stream and |
270 // will be destroyed when the stream goes away. | 268 // will be destroyed when the stream goes away. |
271 typedef std::map<uint32, WebRtcVoiceChannelRenderer*> ChannelMap; | 269 typedef std::map<uint32, WebRtcVoiceChannelRenderer*> ChannelMap; |
272 typedef int (webrtc::VoERTP_RTCP::* ExtensionSetterFunction)(int, bool, | 270 typedef int (webrtc::VoERTP_RTCP::* ExtensionSetterFunction)(int, bool, |
273 unsigned char); | 271 unsigned char); |
274 | 272 |
275 void SetNack(int channel, bool nack_enabled); | 273 void SetNack(int channel, bool nack_enabled); |
276 void SetNack(const ChannelMap& channels, bool nack_enabled); | 274 void SetNack(const ChannelMap& channels, bool nack_enabled); |
277 bool SetSendCodec(const webrtc::CodecInst& send_codec); | 275 bool SetSendCodec(const webrtc::CodecInst& send_codec); |
278 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec); | 276 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec); |
279 bool ChangePlayout(bool playout); | 277 bool ChangePlayout(bool playout); |
280 bool ChangeSend(SendFlags send); | 278 bool ChangeSend(SendFlags send); |
281 bool ChangeSend(int channel, SendFlags send); | 279 bool ChangeSend(int channel, SendFlags send); |
282 void ConfigureSendChannel(int channel); | 280 void ConfigureSendChannel(int channel); |
283 bool ConfigureRecvChannel(int channel); | 281 bool ConfigureRecvChannel(int channel); |
284 bool DeleteChannel(int channel); | 282 bool DeleteChannel(int channel); |
285 bool InConferenceMode() const { | |
286 return options_.conference_mode.GetWithDefaultIfUnset(false); | |
287 } | |
288 bool IsDefaultChannel(int channel_id) const { | 283 bool IsDefaultChannel(int channel_id) const { |
289 return channel_id == default_send_channel_id_; | 284 return channel_id == default_send_channel_id_; |
290 } | 285 } |
291 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); | 286 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); |
292 bool SetSendBitrateInternal(int bps); | 287 bool SetSendBitrateInternal(int bps); |
293 | 288 |
294 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, | 289 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, |
295 const RtpHeaderExtension* extension); | 290 const RtpHeaderExtension* extension); |
296 void RecreateAudioReceiveStreams(); | 291 void RecreateAudioReceiveStreams(); |
297 void AddAudioReceiveStream(uint32 ssrc); | 292 void AddAudioReceiveStream(uint32 ssrc); |
(...skipping 19 matching lines...) Expand all Loading... |
317 AudioOptions options_; | 312 AudioOptions options_; |
318 bool dtmf_allowed_; | 313 bool dtmf_allowed_; |
319 bool desired_playout_; | 314 bool desired_playout_; |
320 bool nack_enabled_; | 315 bool nack_enabled_; |
321 bool playout_; | 316 bool playout_; |
322 bool typing_noise_detected_; | 317 bool typing_noise_detected_; |
323 SendFlags desired_send_; | 318 SendFlags desired_send_; |
324 SendFlags send_; | 319 SendFlags send_; |
325 webrtc::Call* const call_; | 320 webrtc::Call* const call_; |
326 | 321 |
| 322 bool using_default_recv_channel_; |
| 323 uint32_t default_recv_ssrc_; |
| 324 |
327 // send_channels_ contains the channels which are being used for sending. | 325 // send_channels_ contains the channels which are being used for sending. |
328 // When the default channel (default_send_channel_id) is used for sending, it | 326 // When the default channel (default_send_channel_id) is used for sending, it |
329 // is contained in send_channels_, otherwise not. | 327 // is contained in send_channels_, otherwise not. |
330 ChannelMap send_channels_; | 328 ChannelMap send_channels_; |
331 std::vector<RtpHeaderExtension> send_extensions_; | 329 std::vector<RtpHeaderExtension> send_extensions_; |
332 uint32 default_receive_ssrc_; | 330 ChannelMap receive_channels_; |
333 // Note the default channel (default_send_channel_id()) can reside in both | |
334 // receive_channels_ and send_channels_ in non-conference mode and in that | |
335 // case it will only be there if a non-zero default_receive_ssrc_ is set. | |
336 ChannelMap receive_channels_; // for multiple sources | |
337 std::map<uint32, webrtc::AudioReceiveStream*> receive_streams_; | 331 std::map<uint32, webrtc::AudioReceiveStream*> receive_streams_; |
338 std::map<uint32, StreamParams> receive_stream_params_; | 332 std::map<uint32, StreamParams> receive_stream_params_; |
339 // receive_channels_ can be read from WebRtc callback thread. Access from | 333 // receive_channels_ can be read from WebRtc callback thread. Access from |
340 // the WebRtc thread must be synchronized with edits on the worker thread. | 334 // the WebRtc thread must be synchronized with edits on the worker thread. |
341 // Reads on the worker thread are ok. | 335 // Reads on the worker thread are ok. |
342 std::vector<RtpHeaderExtension> receive_extensions_; | 336 std::vector<RtpHeaderExtension> receive_extensions_; |
343 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 337 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
344 | |
345 // Do not lock this on the VoE media processor thread; potential for deadlock | |
346 // exists. | |
347 mutable rtc::CriticalSection receive_channels_cs_; | |
348 }; | 338 }; |
349 | 339 |
350 } // namespace cricket | 340 } // namespace cricket |
351 | 341 |
352 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 342 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
OLD | NEW |