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