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_t ssrc, AudioRenderer* renderer); | 252 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer); |
253 bool MuteStream(uint32_t ssrc, bool mute); | 253 bool MuteStream(uint32_t 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_t 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_t, WebRtcVoiceChannelRenderer*> ChannelMap; | 269 typedef std::map<uint32_t, 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 } |
286 bool IsDefaultRecvStream(uint32_t ssrc) { | |
287 return default_recv_ssrc_ == static_cast<int64_t>(ssrc); | |
288 } | |
291 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); | 289 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); |
292 bool SetSendBitrateInternal(int bps); | 290 bool SetSendBitrateInternal(int bps); |
293 | 291 |
294 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, | 292 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, |
295 const RtpHeaderExtension* extension); | 293 const RtpHeaderExtension* extension); |
296 void RecreateAudioReceiveStreams(); | 294 void RecreateAudioReceiveStreams(); |
297 void AddAudioReceiveStream(uint32_t ssrc); | 295 void AddAudioReceiveStream(uint32_t ssrc); |
298 void RemoveAudioReceiveStream(uint32_t ssrc); | 296 void RemoveAudioReceiveStream(uint32_t ssrc); |
299 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs); | 297 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs); |
300 | 298 |
(...skipping 16 matching lines...) Expand all Loading... | |
317 AudioOptions options_; | 315 AudioOptions options_; |
318 bool dtmf_allowed_; | 316 bool dtmf_allowed_; |
319 bool desired_playout_; | 317 bool desired_playout_; |
320 bool nack_enabled_; | 318 bool nack_enabled_; |
321 bool playout_; | 319 bool playout_; |
322 bool typing_noise_detected_; | 320 bool typing_noise_detected_; |
323 SendFlags desired_send_; | 321 SendFlags desired_send_; |
324 SendFlags send_; | 322 SendFlags send_; |
325 webrtc::Call* const call_; | 323 webrtc::Call* const call_; |
326 | 324 |
325 // SSRC of unsignalled receive stream, or -1 if there isn't one. | |
326 int64_t default_recv_ssrc_; | |
327 double default_recv_volume_; | |
pthatcher1
2015/10/13 05:38:46
Can you leave a comment about when this is set and
the sun
2015/10/13 10:03:28
Done.
| |
328 | |
327 // send_channels_ contains the channels which are being used for sending. | 329 // 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 | 330 // When the default channel (default_send_channel_id) is used for sending, it |
329 // is contained in send_channels_, otherwise not. | 331 // is contained in send_channels_, otherwise not. |
330 ChannelMap send_channels_; | 332 ChannelMap send_channels_; |
331 std::vector<RtpHeaderExtension> send_extensions_; | 333 std::vector<RtpHeaderExtension> send_extensions_; |
332 uint32_t default_receive_ssrc_; | 334 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_t, webrtc::AudioReceiveStream*> receive_streams_; | 335 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_; |
338 std::map<uint32_t, StreamParams> receive_stream_params_; | 336 std::map<uint32_t, StreamParams> receive_stream_params_; |
339 // receive_channels_ can be read from WebRtc callback thread. Access from | 337 // receive_channels_ can be read from WebRtc callback thread. Access from |
340 // the WebRtc thread must be synchronized with edits on the worker thread. | 338 // the WebRtc thread must be synchronized with edits on the worker thread. |
341 // Reads on the worker thread are ok. | 339 // Reads on the worker thread are ok. |
342 std::vector<RtpHeaderExtension> receive_extensions_; | 340 std::vector<RtpHeaderExtension> receive_extensions_; |
343 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 341 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 }; | 342 }; |
349 | 343 |
350 } // namespace cricket | 344 } // namespace cricket |
351 | 345 |
352 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 346 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
OLD | NEW |