Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: talk/media/webrtc/webrtcvoiceengine.h

Issue 1385893002: Remove default receive channel from WVoE; baby step 3. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | talk/media/webrtc/webrtcvoiceengine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_ = -1;
327 // Volume for unsignalled stream, which may be set before the stream exists.
328 double default_recv_volume_ = 1.0;
329
327 // send_channels_ contains the channels which are being used for sending. 330 // 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 331 // When the default channel (default_send_channel_id) is used for sending, it
329 // is contained in send_channels_, otherwise not. 332 // is contained in send_channels_, otherwise not.
330 ChannelMap send_channels_; 333 ChannelMap send_channels_;
331 std::vector<RtpHeaderExtension> send_extensions_; 334 std::vector<RtpHeaderExtension> send_extensions_;
332 uint32_t default_receive_ssrc_; 335 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_; 336 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_;
338 std::map<uint32_t, StreamParams> receive_stream_params_; 337 std::map<uint32_t, StreamParams> receive_stream_params_;
339 // receive_channels_ can be read from WebRtc callback thread. Access from 338 // receive_channels_ can be read from WebRtc callback thread. Access from
340 // the WebRtc thread must be synchronized with edits on the worker thread. 339 // the WebRtc thread must be synchronized with edits on the worker thread.
341 // Reads on the worker thread are ok. 340 // Reads on the worker thread are ok.
342 std::vector<RtpHeaderExtension> receive_extensions_; 341 std::vector<RtpHeaderExtension> receive_extensions_;
343 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 342 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 }; 343 };
349 344
350 } // namespace cricket 345 } // namespace cricket
351 346
352 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ 347 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « no previous file | talk/media/webrtc/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698