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

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

Issue 1269863005: MediaController/Call instantiation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove redundant reset(nullptr) Created 5 years, 3 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
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 public: 94 public:
95 WebRtcVoiceEngine(); 95 WebRtcVoiceEngine();
96 // Dependency injection for testing. 96 // Dependency injection for testing.
97 WebRtcVoiceEngine(VoEWrapper* voe_wrapper, VoETraceWrapper* tracing); 97 WebRtcVoiceEngine(VoEWrapper* voe_wrapper, VoETraceWrapper* tracing);
98 ~WebRtcVoiceEngine(); 98 ~WebRtcVoiceEngine();
99 bool Init(rtc::Thread* worker_thread); 99 bool Init(rtc::Thread* worker_thread);
100 void Terminate(); 100 void Terminate();
101 101
102 int GetCapabilities(); 102 int GetCapabilities();
103 VoiceMediaChannel* CreateChannel(const AudioOptions& options); 103 webrtc::VoiceEngine* GetVoE() { return voe()->engine(); }
104 VoiceMediaChannel* CreateChannel(webrtc::Call* call,
105 const AudioOptions& options);
104 106
105 AudioOptions GetOptions() const { return options_; } 107 AudioOptions GetOptions() const { return options_; }
106 bool SetOptions(const AudioOptions& options); 108 bool SetOptions(const AudioOptions& options);
107 bool SetDelayOffset(int offset); 109 bool SetDelayOffset(int offset);
108 bool SetDevices(const Device* in_device, const Device* out_device); 110 bool SetDevices(const Device* in_device, const Device* out_device);
109 bool GetOutputVolume(int* level); 111 bool GetOutputVolume(int* level);
110 bool SetOutputVolume(int level); 112 bool SetOutputVolume(int level);
111 int GetInputLevel(); 113 int GetInputLevel();
112 bool SetLocalMonitor(bool enable); 114 bool SetLocalMonitor(bool enable);
113 115
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 Settable<bool> extended_filter_aec_; 275 Settable<bool> extended_filter_aec_;
274 Settable<bool> delay_agnostic_aec_; 276 Settable<bool> delay_agnostic_aec_;
275 Settable<bool> experimental_ns_; 277 Settable<bool> experimental_ns_;
276 }; 278 };
277 279
278 // WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses 280 // WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses
279 // WebRtc Voice Engine. 281 // WebRtc Voice Engine.
280 class WebRtcVoiceMediaChannel : public VoiceMediaChannel, 282 class WebRtcVoiceMediaChannel : public VoiceMediaChannel,
281 public webrtc::Transport { 283 public webrtc::Transport {
282 public: 284 public:
283 explicit WebRtcVoiceMediaChannel(WebRtcVoiceEngine *engine); 285 explicit WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine,
286 webrtc::Call* call);
284 ~WebRtcVoiceMediaChannel() override; 287 ~WebRtcVoiceMediaChannel() override;
285 288
286 int voe_channel() const { return voe_channel_; } 289 int voe_channel() const { return voe_channel_; }
287 bool valid() const { return voe_channel_ != -1; } 290 bool valid() const { return voe_channel_ != -1; }
288 const AudioOptions& options() const { return options_; } 291 const AudioOptions& options() const { return options_; }
289 292
290 bool SetSendParameters(const AudioSendParameters& params) override; 293 bool SetSendParameters(const AudioSendParameters& params) override;
291 bool SetRecvParameters(const AudioRecvParameters& params) override; 294 bool SetRecvParameters(const AudioRecvParameters& params) override;
292 bool SetOptions(const AudioOptions& options) override; 295 bool SetOptions(const AudioOptions& options) override;
293 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs) override; 296 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs) override;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 return VoiceMediaChannel::SendRtcp(&packet) ? static_cast<int>(len) : -1; 352 return VoiceMediaChannel::SendRtcp(&packet) ? static_cast<int>(len) : -1;
350 } 353 }
351 354
352 bool FindSsrc(int channel_num, uint32* ssrc); 355 bool FindSsrc(int channel_num, uint32* ssrc);
353 void OnError(uint32 ssrc, int error); 356 void OnError(uint32 ssrc, int error);
354 357
355 bool sending() const { return send_ != SEND_NOTHING; } 358 bool sending() const { return send_ != SEND_NOTHING; }
356 int GetReceiveChannelNum(uint32 ssrc) const; 359 int GetReceiveChannelNum(uint32 ssrc) const;
357 int GetSendChannelNum(uint32 ssrc) const; 360 int GetSendChannelNum(uint32 ssrc) const;
358 361
359 void SetCall(webrtc::Call* call);
360
361 private: 362 private:
362 bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer); 363 bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer);
363 bool MuteStream(uint32 ssrc, bool mute); 364 bool MuteStream(uint32 ssrc, bool mute);
364 WebRtcVoiceEngine* engine() { return engine_; } 365 WebRtcVoiceEngine* engine() { return engine_; }
365 int GetLastEngineError() { return engine()->GetLastEngineError(); } 366 int GetLastEngineError() { return engine()->GetLastEngineError(); }
366 int GetOutputLevel(int channel); 367 int GetOutputLevel(int channel);
367 bool GetRedSendCodec(const AudioCodec& red_codec, 368 bool GetRedSendCodec(const AudioCodec& red_codec,
368 const std::vector<AudioCodec>& all_codecs, 369 const std::vector<AudioCodec>& all_codecs,
369 webrtc::CodecInst* send_codec); 370 webrtc::CodecInst* send_codec);
370 bool EnableRtcp(int channel); 371 bool EnableRtcp(int channel);
(...skipping 24 matching lines...) Expand all
395 return options_.conference_mode.GetWithDefaultIfUnset(false); 396 return options_.conference_mode.GetWithDefaultIfUnset(false);
396 } 397 }
397 bool IsDefaultChannel(int channel_id) const { 398 bool IsDefaultChannel(int channel_id) const {
398 return channel_id == voe_channel(); 399 return channel_id == voe_channel();
399 } 400 }
400 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); 401 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs);
401 bool SetSendBitrateInternal(int bps); 402 bool SetSendBitrateInternal(int bps);
402 403
403 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, 404 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id,
404 const RtpHeaderExtension* extension); 405 const RtpHeaderExtension* extension);
405 void TryAddAudioRecvStream(uint32 ssrc); 406 void RecreateAudioReceiveStreams();
406 void TryRemoveAudioRecvStream(uint32 ssrc); 407 void AddAudioReceiveStream(uint32 ssrc);
408 void RemoveAudioReceiveStream(uint32 ssrc);
407 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs); 409 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs);
408 410
409 bool SetChannelRecvRtpHeaderExtensions( 411 bool SetChannelRecvRtpHeaderExtensions(
410 int channel_id, 412 int channel_id,
411 const std::vector<RtpHeaderExtension>& extensions); 413 const std::vector<RtpHeaderExtension>& extensions);
412 bool SetChannelSendRtpHeaderExtensions( 414 bool SetChannelSendRtpHeaderExtensions(
413 int channel_id, 415 int channel_id,
414 const std::vector<RtpHeaderExtension>& extensions); 416 const std::vector<RtpHeaderExtension>& extensions);
415 417
416 rtc::ThreadChecker thread_checker_; 418 rtc::ThreadChecker thread_checker_;
417 419
418 WebRtcVoiceEngine* engine_; 420 WebRtcVoiceEngine* const engine_;
419 const int voe_channel_; 421 const int voe_channel_;
420 rtc::scoped_ptr<WebRtcSoundclipStream> ringback_tone_; 422 rtc::scoped_ptr<WebRtcSoundclipStream> ringback_tone_;
421 std::set<int> ringback_channels_; // channels playing ringback 423 std::set<int> ringback_channels_; // channels playing ringback
422 std::vector<AudioCodec> recv_codecs_; 424 std::vector<AudioCodec> recv_codecs_;
423 std::vector<AudioCodec> send_codecs_; 425 std::vector<AudioCodec> send_codecs_;
424 rtc::scoped_ptr<webrtc::CodecInst> send_codec_; 426 rtc::scoped_ptr<webrtc::CodecInst> send_codec_;
425 bool send_bitrate_setting_; 427 bool send_bitrate_setting_;
426 int send_bitrate_bps_; 428 int send_bitrate_bps_;
427 AudioOptions options_; 429 AudioOptions options_;
428 bool dtmf_allowed_; 430 bool dtmf_allowed_;
429 bool desired_playout_; 431 bool desired_playout_;
430 bool nack_enabled_; 432 bool nack_enabled_;
431 bool playout_; 433 bool playout_;
432 bool typing_noise_detected_; 434 bool typing_noise_detected_;
433 SendFlags desired_send_; 435 SendFlags desired_send_;
434 SendFlags send_; 436 SendFlags send_;
435 webrtc::Call* call_; 437 webrtc::Call* const call_;
436 438
437 // send_channels_ contains the channels which are being used for sending. 439 // send_channels_ contains the channels which are being used for sending.
438 // When the default channel (voe_channel) is used for sending, it is 440 // When the default channel (voe_channel) is used for sending, it is
439 // contained in send_channels_, otherwise not. 441 // contained in send_channels_, otherwise not.
440 ChannelMap send_channels_; 442 ChannelMap send_channels_;
441 std::vector<RtpHeaderExtension> send_extensions_; 443 std::vector<RtpHeaderExtension> send_extensions_;
442 uint32 default_receive_ssrc_; 444 uint32 default_receive_ssrc_;
443 // Note the default channel (voe_channel()) can reside in both 445 // Note the default channel (voe_channel()) can reside in both
444 // receive_channels_ and send_channels_ in non-conference mode and in that 446 // receive_channels_ and send_channels_ in non-conference mode and in that
445 // case it will only be there if a non-zero default_receive_ssrc_ is set. 447 // case it will only be there if a non-zero default_receive_ssrc_ is set.
446 ChannelMap receive_channels_; // for multiple sources 448 ChannelMap receive_channels_; // for multiple sources
447 std::map<uint32, webrtc::AudioReceiveStream*> receive_streams_; 449 std::map<uint32, webrtc::AudioReceiveStream*> receive_streams_;
448 std::map<uint32, StreamParams> receive_stream_params_; 450 std::map<uint32, StreamParams> receive_stream_params_;
449 // receive_channels_ can be read from WebRtc callback thread. Access from 451 // receive_channels_ can be read from WebRtc callback thread. Access from
450 // the WebRtc thread must be synchronized with edits on the worker thread. 452 // the WebRtc thread must be synchronized with edits on the worker thread.
451 // Reads on the worker thread are ok. 453 // Reads on the worker thread are ok.
452 std::vector<RtpHeaderExtension> receive_extensions_; 454 std::vector<RtpHeaderExtension> receive_extensions_;
453 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 455 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
454 456
455 // Do not lock this on the VoE media processor thread; potential for deadlock 457 // Do not lock this on the VoE media processor thread; potential for deadlock
456 // exists. 458 // exists.
457 mutable rtc::CriticalSection receive_channels_cs_; 459 mutable rtc::CriticalSection receive_channels_cs_;
458 }; 460 };
459 461
460 } // namespace cricket 462 } // namespace cricket
461 463
462 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ 464 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2_unittest.cc ('k') | talk/media/webrtc/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698