OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 class VoERtcpObserver; | 76 class VoERtcpObserver; |
77 | 77 |
78 // Helper class to simplify locking scheme for members that are accessed from | 78 // Helper class to simplify locking scheme for members that are accessed from |
79 // multiple threads. | 79 // multiple threads. |
80 // Example: a member can be set on thread T1 and read by an internal audio | 80 // Example: a member can be set on thread T1 and read by an internal audio |
81 // thread T2. Accessing the member via this class ensures that we are | 81 // thread T2. Accessing the member via this class ensures that we are |
82 // safe and also avoid TSan v2 warnings. | 82 // safe and also avoid TSan v2 warnings. |
83 class ChannelState { | 83 class ChannelState { |
84 public: | 84 public: |
85 struct State { | 85 struct State { |
86 State() | 86 bool input_external_media = false; |
87 : rx_apm_is_enabled(false), | 87 bool output_file_playing = false; |
88 input_external_media(false), | 88 bool input_file_playing = false; |
89 output_file_playing(false), | 89 bool playing = false; |
90 input_file_playing(false), | 90 bool sending = false; |
91 playing(false), | 91 bool receiving = false; |
92 sending(false), | |
93 receiving(false) {} | |
94 | |
95 bool rx_apm_is_enabled; | |
96 bool input_external_media; | |
97 bool output_file_playing; | |
98 bool input_file_playing; | |
99 bool playing; | |
100 bool sending; | |
101 bool receiving; | |
102 }; | 92 }; |
103 | 93 |
104 ChannelState() {} | 94 ChannelState() {} |
105 virtual ~ChannelState() {} | 95 virtual ~ChannelState() {} |
106 | 96 |
107 void Reset() { | 97 void Reset() { |
108 rtc::CritScope lock(&lock_); | 98 rtc::CritScope lock(&lock_); |
109 state_ = State(); | 99 state_ = State(); |
110 } | 100 } |
111 | 101 |
112 State Get() const { | 102 State Get() const { |
113 rtc::CritScope lock(&lock_); | 103 rtc::CritScope lock(&lock_); |
114 return state_; | 104 return state_; |
115 } | 105 } |
116 | 106 |
117 void SetRxApmIsEnabled(bool enable) { | |
118 rtc::CritScope lock(&lock_); | |
119 state_.rx_apm_is_enabled = enable; | |
120 } | |
121 | |
122 void SetInputExternalMedia(bool enable) { | 107 void SetInputExternalMedia(bool enable) { |
123 rtc::CritScope lock(&lock_); | 108 rtc::CritScope lock(&lock_); |
124 state_.input_external_media = enable; | 109 state_.input_external_media = enable; |
125 } | 110 } |
126 | 111 |
127 void SetOutputFilePlaying(bool enable) { | 112 void SetOutputFilePlaying(bool enable) { |
128 rtc::CritScope lock(&lock_); | 113 rtc::CritScope lock(&lock_); |
129 state_.output_file_playing = enable; | 114 state_.output_file_playing = enable; |
130 } | 115 } |
131 | 116 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 int SetInitSequenceNumber(short sequenceNumber); | 288 int SetInitSequenceNumber(short sequenceNumber); |
304 | 289 |
305 // VoEVideoSyncExtended | 290 // VoEVideoSyncExtended |
306 int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const; | 291 int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const; |
307 | 292 |
308 // DTMF | 293 // DTMF |
309 int SendTelephoneEventOutband(int event, int duration_ms); | 294 int SendTelephoneEventOutband(int event, int duration_ms); |
310 int SetSendTelephoneEventPayloadType(int payload_type); | 295 int SetSendTelephoneEventPayloadType(int payload_type); |
311 | 296 |
312 // VoEAudioProcessingImpl | 297 // VoEAudioProcessingImpl |
313 int UpdateRxVadDetection(AudioFrame& audioFrame); | |
314 int RegisterRxVadObserver(VoERxVadCallback& observer); | |
315 int DeRegisterRxVadObserver(); | |
316 int VoiceActivityIndicator(int& activity); | 298 int VoiceActivityIndicator(int& activity); |
317 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
318 int SetRxAgcStatus(bool enable, AgcModes mode); | |
319 int GetRxAgcStatus(bool& enabled, AgcModes& mode); | |
320 int SetRxAgcConfig(AgcConfig config); | |
321 int GetRxAgcConfig(AgcConfig& config); | |
322 #endif | |
323 #ifdef WEBRTC_VOICE_ENGINE_NR | |
324 int SetRxNsStatus(bool enable, NsModes mode); | |
325 int GetRxNsStatus(bool& enabled, NsModes& mode); | |
326 #endif | |
327 | 299 |
328 // VoERTP_RTCP | 300 // VoERTP_RTCP |
329 int SetLocalSSRC(unsigned int ssrc); | 301 int SetLocalSSRC(unsigned int ssrc); |
330 int GetLocalSSRC(unsigned int& ssrc); | 302 int GetLocalSSRC(unsigned int& ssrc); |
331 int GetRemoteSSRC(unsigned int& ssrc); | 303 int GetRemoteSSRC(unsigned int& ssrc); |
332 int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id); | 304 int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id); |
333 int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id); | 305 int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id); |
334 int SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id); | 306 int SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id); |
335 int SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id); | 307 int SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id); |
336 void EnableSendTransportSequenceNumber(int id); | 308 void EnableSendTransportSequenceNumber(int id); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 int32_t SendData(FrameType frameType, | 342 int32_t SendData(FrameType frameType, |
371 uint8_t payloadType, | 343 uint8_t payloadType, |
372 uint32_t timeStamp, | 344 uint32_t timeStamp, |
373 const uint8_t* payloadData, | 345 const uint8_t* payloadData, |
374 size_t payloadSize, | 346 size_t payloadSize, |
375 const RTPFragmentationHeader* fragmentation) override; | 347 const RTPFragmentationHeader* fragmentation) override; |
376 | 348 |
377 // From ACMVADCallback in the ACM | 349 // From ACMVADCallback in the ACM |
378 int32_t InFrameType(FrameType frame_type) override; | 350 int32_t InFrameType(FrameType frame_type) override; |
379 | 351 |
380 int32_t OnRxVadDetected(int vadDecision); | |
381 | |
382 // From RtpData in the RTP/RTCP module | 352 // From RtpData in the RTP/RTCP module |
383 int32_t OnReceivedPayloadData(const uint8_t* payloadData, | 353 int32_t OnReceivedPayloadData(const uint8_t* payloadData, |
384 size_t payloadSize, | 354 size_t payloadSize, |
385 const WebRtcRTPHeader* rtpHeader) override; | 355 const WebRtcRTPHeader* rtpHeader) override; |
386 bool OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override; | 356 bool OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override; |
387 | 357 |
388 // From RtpFeedback in the RTP/RTCP module | 358 // From RtpFeedback in the RTP/RTCP module |
389 int32_t OnInitializeDecoder(int8_t payloadType, | 359 int32_t OnInitializeDecoder(int8_t payloadType, |
390 const char payloadName[RTP_PAYLOAD_NAME_SIZE], | 360 const char payloadName[RTP_PAYLOAD_NAME_SIZE], |
391 int frequency, | 361 int frequency, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // uses | 506 // uses |
537 Statistics* _engineStatisticsPtr; | 507 Statistics* _engineStatisticsPtr; |
538 OutputMixer* _outputMixerPtr; | 508 OutputMixer* _outputMixerPtr; |
539 TransmitMixer* _transmitMixerPtr; | 509 TransmitMixer* _transmitMixerPtr; |
540 ProcessThread* _moduleProcessThreadPtr; | 510 ProcessThread* _moduleProcessThreadPtr; |
541 AudioDeviceModule* _audioDeviceModulePtr; | 511 AudioDeviceModule* _audioDeviceModulePtr; |
542 VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base | 512 VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base |
543 rtc::CriticalSection* _callbackCritSectPtr; // owned by base | 513 rtc::CriticalSection* _callbackCritSectPtr; // owned by base |
544 Transport* _transportPtr; // WebRtc socket or external transport | 514 Transport* _transportPtr; // WebRtc socket or external transport |
545 RMSLevel rms_level_; | 515 RMSLevel rms_level_; |
546 std::unique_ptr<AudioProcessing> rx_audioproc_; // far end AudioProcessing | |
547 VoERxVadCallback* _rxVadObserverPtr; | |
548 int32_t _oldVadDecision; | |
549 int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise | 516 int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise |
550 // VoEBase | 517 // VoEBase |
551 bool _externalMixing; | 518 bool _externalMixing; |
552 bool _mixFileWithMicrophone; | 519 bool _mixFileWithMicrophone; |
553 // VoEVolumeControl | 520 // VoEVolumeControl |
554 bool input_mute_ GUARDED_BY(volume_settings_critsect_); | 521 bool input_mute_ GUARDED_BY(volume_settings_critsect_); |
555 bool previous_frame_muted_; // Only accessed from PrepareEncodeAndSend(). | 522 bool previous_frame_muted_; // Only accessed from PrepareEncodeAndSend(). |
556 float _panLeft GUARDED_BY(volume_settings_critsect_); | 523 float _panLeft GUARDED_BY(volume_settings_critsect_); |
557 float _panRight GUARDED_BY(volume_settings_critsect_); | 524 float _panRight GUARDED_BY(volume_settings_critsect_); |
558 float _outputGain GUARDED_BY(volume_settings_critsect_); | 525 float _outputGain GUARDED_BY(volume_settings_critsect_); |
559 // VoeRTP_RTCP | 526 // VoeRTP_RTCP |
560 uint32_t _lastLocalTimeStamp; | 527 uint32_t _lastLocalTimeStamp; |
561 int8_t _lastPayloadType; | 528 int8_t _lastPayloadType; |
562 bool _includeAudioLevelIndication; | 529 bool _includeAudioLevelIndication; |
563 // VoENetwork | 530 // VoENetwork |
564 AudioFrame::SpeechType _outputSpeechType; | 531 AudioFrame::SpeechType _outputSpeechType; |
565 // VoEVideoSync | 532 // VoEVideoSync |
566 rtc::CriticalSection video_sync_lock_; | 533 rtc::CriticalSection video_sync_lock_; |
567 // VoEAudioProcessing | 534 // VoEAudioProcessing |
568 bool _RxVadDetection; | |
569 bool _rxAgcIsEnabled; | |
570 bool _rxNsIsEnabled; | |
571 bool restored_packet_in_use_; | 535 bool restored_packet_in_use_; |
572 // RtcpBandwidthObserver | 536 // RtcpBandwidthObserver |
573 std::unique_ptr<VoERtcpObserver> rtcp_observer_; | 537 std::unique_ptr<VoERtcpObserver> rtcp_observer_; |
574 std::unique_ptr<NetworkPredictor> network_predictor_; | 538 std::unique_ptr<NetworkPredictor> network_predictor_; |
575 // An associated send channel. | 539 // An associated send channel. |
576 rtc::CriticalSection assoc_send_channel_lock_; | 540 rtc::CriticalSection assoc_send_channel_lock_; |
577 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); | 541 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); |
578 | 542 |
579 bool pacing_enabled_; | 543 bool pacing_enabled_; |
580 PacketRouter* packet_router_ = nullptr; | 544 PacketRouter* packet_router_ = nullptr; |
581 std::unique_ptr<TransportFeedbackProxy> feedback_observer_proxy_; | 545 std::unique_ptr<TransportFeedbackProxy> feedback_observer_proxy_; |
582 std::unique_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_; | 546 std::unique_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_; |
583 std::unique_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_; | 547 std::unique_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_; |
584 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; | 548 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; |
585 | 549 |
586 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. | 550 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. |
587 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 551 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
588 }; | 552 }; |
589 | 553 |
590 } // namespace voe | 554 } // namespace voe |
591 } // namespace webrtc | 555 } // namespace webrtc |
592 | 556 |
593 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ | 557 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ |
OLD | NEW |