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