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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 | 291 |
289 bool SetSendParameters(const AudioSendParameters& params) override; | 292 bool SetSendParameters(const AudioSendParameters& params) override; |
290 bool SetRecvParameters(const AudioRecvParameters& params) override; | 293 bool SetRecvParameters(const AudioRecvParameters& params) override; |
291 bool SetOptions(const AudioOptions& options) override; | 294 bool SetOptions(const AudioOptions& options) override; |
292 bool GetOptions(AudioOptions* options) const override { | 295 bool GetOptions(AudioOptions* options) const override { |
293 *options = options_; | 296 *options = options_; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 return VoiceMediaChannel::SendRtcp(&packet) ? static_cast<int>(len) : -1; | 356 return VoiceMediaChannel::SendRtcp(&packet) ? static_cast<int>(len) : -1; |
354 } | 357 } |
355 | 358 |
356 bool FindSsrc(int channel_num, uint32* ssrc); | 359 bool FindSsrc(int channel_num, uint32* ssrc); |
357 void OnError(uint32 ssrc, int error); | 360 void OnError(uint32 ssrc, int error); |
358 | 361 |
359 bool sending() const { return send_ != SEND_NOTHING; } | 362 bool sending() const { return send_ != SEND_NOTHING; } |
360 int GetReceiveChannelNum(uint32 ssrc) const; | 363 int GetReceiveChannelNum(uint32 ssrc) const; |
361 int GetSendChannelNum(uint32 ssrc) const; | 364 int GetSendChannelNum(uint32 ssrc) const; |
362 | 365 |
363 void SetCall(webrtc::Call* call); | |
364 | |
365 private: | 366 private: |
366 WebRtcVoiceEngine* engine() { return engine_; } | 367 WebRtcVoiceEngine* engine() { return engine_; } |
367 int GetLastEngineError() { return engine()->GetLastEngineError(); } | 368 int GetLastEngineError() { return engine()->GetLastEngineError(); } |
368 int GetOutputLevel(int channel); | 369 int GetOutputLevel(int channel); |
369 bool GetRedSendCodec(const AudioCodec& red_codec, | 370 bool GetRedSendCodec(const AudioCodec& red_codec, |
370 const std::vector<AudioCodec>& all_codecs, | 371 const std::vector<AudioCodec>& all_codecs, |
371 webrtc::CodecInst* send_codec); | 372 webrtc::CodecInst* send_codec); |
372 bool EnableRtcp(int channel); | 373 bool EnableRtcp(int channel); |
373 bool ResetRecvCodecs(int channel); | 374 bool ResetRecvCodecs(int channel); |
374 bool SetPlayout(int channel, bool playout); | 375 bool SetPlayout(int channel, bool playout); |
(...skipping 22 matching lines...) Expand all Loading... |
397 return options_.conference_mode.GetWithDefaultIfUnset(false); | 398 return options_.conference_mode.GetWithDefaultIfUnset(false); |
398 } | 399 } |
399 bool IsDefaultChannel(int channel_id) const { | 400 bool IsDefaultChannel(int channel_id) const { |
400 return channel_id == voe_channel(); | 401 return channel_id == voe_channel(); |
401 } | 402 } |
402 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); | 403 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); |
403 bool SetSendBitrateInternal(int bps); | 404 bool SetSendBitrateInternal(int bps); |
404 | 405 |
405 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, | 406 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, |
406 const RtpHeaderExtension* extension); | 407 const RtpHeaderExtension* extension); |
407 void TryAddAudioRecvStream(uint32 ssrc); | 408 void RecreateCallStreams(); |
408 void TryRemoveAudioRecvStream(uint32 ssrc); | 409 void AddAudioRecvStream(uint32 ssrc); |
| 410 void RemoveAudioRecvStream(uint32 ssrc); |
409 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs); | 411 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs); |
410 | 412 |
411 bool SetChannelRecvRtpHeaderExtensions( | 413 bool SetChannelRecvRtpHeaderExtensions( |
412 int channel_id, | 414 int channel_id, |
413 const std::vector<RtpHeaderExtension>& extensions); | 415 const std::vector<RtpHeaderExtension>& extensions); |
414 bool SetChannelSendRtpHeaderExtensions( | 416 bool SetChannelSendRtpHeaderExtensions( |
415 int channel_id, | 417 int channel_id, |
416 const std::vector<RtpHeaderExtension>& extensions); | 418 const std::vector<RtpHeaderExtension>& extensions); |
417 | 419 |
418 rtc::ThreadChecker thread_checker_; | 420 rtc::ThreadChecker thread_checker_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 457 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
456 | 458 |
457 // Do not lock this on the VoE media processor thread; potential for deadlock | 459 // Do not lock this on the VoE media processor thread; potential for deadlock |
458 // exists. | 460 // exists. |
459 mutable rtc::CriticalSection receive_channels_cs_; | 461 mutable rtc::CriticalSection receive_channels_cs_; |
460 }; | 462 }; |
461 | 463 |
462 } // namespace cricket | 464 } // namespace cricket |
463 | 465 |
464 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 466 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
OLD | NEW |