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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 int SetInitSequenceNumber(short sequenceNumber); | 286 int SetInitSequenceNumber(short sequenceNumber); |
302 | 287 |
303 // VoEVideoSyncExtended | 288 // VoEVideoSyncExtended |
304 int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const; | 289 int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const; |
305 | 290 |
306 // DTMF | 291 // DTMF |
307 int SendTelephoneEventOutband(int event, int duration_ms); | 292 int SendTelephoneEventOutband(int event, int duration_ms); |
308 int SetSendTelephoneEventPayloadType(int payload_type); | 293 int SetSendTelephoneEventPayloadType(int payload_type); |
309 | 294 |
310 // VoEAudioProcessingImpl | 295 // VoEAudioProcessingImpl |
311 int UpdateRxVadDetection(AudioFrame& audioFrame); | |
312 int RegisterRxVadObserver(VoERxVadCallback& observer); | |
313 int DeRegisterRxVadObserver(); | |
314 int VoiceActivityIndicator(int& activity); | 296 int VoiceActivityIndicator(int& activity); |
315 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
316 int SetRxAgcStatus(bool enable, AgcModes mode); | |
317 int GetRxAgcStatus(bool& enabled, AgcModes& mode); | |
318 int SetRxAgcConfig(AgcConfig config); | |
319 int GetRxAgcConfig(AgcConfig& config); | |
320 #endif | |
321 #ifdef WEBRTC_VOICE_ENGINE_NR | |
322 int SetRxNsStatus(bool enable, NsModes mode); | |
323 int GetRxNsStatus(bool& enabled, NsModes& mode); | |
324 #endif | |
325 | 297 |
326 // VoERTP_RTCP | 298 // VoERTP_RTCP |
327 int SetLocalSSRC(unsigned int ssrc); | 299 int SetLocalSSRC(unsigned int ssrc); |
328 int GetLocalSSRC(unsigned int& ssrc); | 300 int GetLocalSSRC(unsigned int& ssrc); |
329 int GetRemoteSSRC(unsigned int& ssrc); | 301 int GetRemoteSSRC(unsigned int& ssrc); |
330 int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id); | 302 int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id); |
331 int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id); | 303 int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id); |
332 int SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id); | 304 int SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id); |
333 int SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id); | 305 int SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id); |
334 void EnableSendTransportSequenceNumber(int id); | 306 void EnableSendTransportSequenceNumber(int id); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 int32_t SendData(FrameType frameType, | 340 int32_t SendData(FrameType frameType, |
369 uint8_t payloadType, | 341 uint8_t payloadType, |
370 uint32_t timeStamp, | 342 uint32_t timeStamp, |
371 const uint8_t* payloadData, | 343 const uint8_t* payloadData, |
372 size_t payloadSize, | 344 size_t payloadSize, |
373 const RTPFragmentationHeader* fragmentation) override; | 345 const RTPFragmentationHeader* fragmentation) override; |
374 | 346 |
375 // From ACMVADCallback in the ACM | 347 // From ACMVADCallback in the ACM |
376 int32_t InFrameType(FrameType frame_type) override; | 348 int32_t InFrameType(FrameType frame_type) override; |
377 | 349 |
378 int32_t OnRxVadDetected(int vadDecision); | |
379 | |
380 // From RtpData in the RTP/RTCP module | 350 // From RtpData in the RTP/RTCP module |
381 int32_t OnReceivedPayloadData(const uint8_t* payloadData, | 351 int32_t OnReceivedPayloadData(const uint8_t* payloadData, |
382 size_t payloadSize, | 352 size_t payloadSize, |
383 const WebRtcRTPHeader* rtpHeader) override; | 353 const WebRtcRTPHeader* rtpHeader) override; |
384 bool OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override; | 354 bool OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override; |
385 | 355 |
386 // From RtpFeedback in the RTP/RTCP module | 356 // From RtpFeedback in the RTP/RTCP module |
387 int32_t OnInitializeDecoder(int8_t payloadType, | 357 int32_t OnInitializeDecoder(int8_t payloadType, |
388 const char payloadName[RTP_PAYLOAD_NAME_SIZE], | 358 const char payloadName[RTP_PAYLOAD_NAME_SIZE], |
389 int frequency, | 359 int frequency, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 // uses | 504 // uses |
535 Statistics* _engineStatisticsPtr; | 505 Statistics* _engineStatisticsPtr; |
536 OutputMixer* _outputMixerPtr; | 506 OutputMixer* _outputMixerPtr; |
537 TransmitMixer* _transmitMixerPtr; | 507 TransmitMixer* _transmitMixerPtr; |
538 ProcessThread* _moduleProcessThreadPtr; | 508 ProcessThread* _moduleProcessThreadPtr; |
539 AudioDeviceModule* _audioDeviceModulePtr; | 509 AudioDeviceModule* _audioDeviceModulePtr; |
540 VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base | 510 VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base |
541 rtc::CriticalSection* _callbackCritSectPtr; // owned by base | 511 rtc::CriticalSection* _callbackCritSectPtr; // owned by base |
542 Transport* _transportPtr; // WebRtc socket or external transport | 512 Transport* _transportPtr; // WebRtc socket or external transport |
543 RMSLevel rms_level_; | 513 RMSLevel rms_level_; |
544 std::unique_ptr<AudioProcessing> rx_audioproc_; // far end AudioProcessing | |
545 VoERxVadCallback* _rxVadObserverPtr; | |
546 int32_t _oldVadDecision; | |
547 int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise | 514 int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise |
548 // VoEBase | 515 // VoEBase |
549 bool _externalMixing; | 516 bool _externalMixing; |
550 bool _mixFileWithMicrophone; | 517 bool _mixFileWithMicrophone; |
551 // VoEVolumeControl | 518 // VoEVolumeControl |
552 bool input_mute_ GUARDED_BY(volume_settings_critsect_); | 519 bool input_mute_ GUARDED_BY(volume_settings_critsect_); |
553 bool previous_frame_muted_; // Only accessed from PrepareEncodeAndSend(). | 520 bool previous_frame_muted_; // Only accessed from PrepareEncodeAndSend(). |
554 float _panLeft GUARDED_BY(volume_settings_critsect_); | 521 float _panLeft GUARDED_BY(volume_settings_critsect_); |
555 float _panRight GUARDED_BY(volume_settings_critsect_); | 522 float _panRight GUARDED_BY(volume_settings_critsect_); |
556 float _outputGain GUARDED_BY(volume_settings_critsect_); | 523 float _outputGain GUARDED_BY(volume_settings_critsect_); |
557 // VoeRTP_RTCP | 524 // VoeRTP_RTCP |
558 uint32_t _lastLocalTimeStamp; | 525 uint32_t _lastLocalTimeStamp; |
559 int8_t _lastPayloadType; | 526 int8_t _lastPayloadType; |
560 bool _includeAudioLevelIndication; | 527 bool _includeAudioLevelIndication; |
561 // VoENetwork | 528 // VoENetwork |
562 AudioFrame::SpeechType _outputSpeechType; | 529 AudioFrame::SpeechType _outputSpeechType; |
563 // VoEVideoSync | 530 // VoEVideoSync |
564 rtc::CriticalSection video_sync_lock_; | 531 rtc::CriticalSection video_sync_lock_; |
565 // VoEAudioProcessing | 532 // VoEAudioProcessing |
566 bool _RxVadDetection; | |
567 bool _rxAgcIsEnabled; | |
568 bool _rxNsIsEnabled; | |
569 bool restored_packet_in_use_; | 533 bool restored_packet_in_use_; |
570 // RtcpBandwidthObserver | 534 // RtcpBandwidthObserver |
571 std::unique_ptr<VoERtcpObserver> rtcp_observer_; | 535 std::unique_ptr<VoERtcpObserver> rtcp_observer_; |
572 std::unique_ptr<NetworkPredictor> network_predictor_; | 536 std::unique_ptr<NetworkPredictor> network_predictor_; |
573 // An associated send channel. | 537 // An associated send channel. |
574 rtc::CriticalSection assoc_send_channel_lock_; | 538 rtc::CriticalSection assoc_send_channel_lock_; |
575 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); | 539 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); |
576 | 540 |
577 bool pacing_enabled_; | 541 bool pacing_enabled_; |
578 PacketRouter* packet_router_ = nullptr; | 542 PacketRouter* packet_router_ = nullptr; |
579 std::unique_ptr<TransportFeedbackProxy> feedback_observer_proxy_; | 543 std::unique_ptr<TransportFeedbackProxy> feedback_observer_proxy_; |
580 std::unique_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_; | 544 std::unique_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_; |
581 std::unique_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_; | 545 std::unique_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_; |
582 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; | 546 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; |
583 | 547 |
584 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. | 548 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. |
585 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 549 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
586 }; | 550 }; |
587 | 551 |
588 } // namespace voe | 552 } // namespace voe |
589 } // namespace webrtc | 553 } // namespace webrtc |
590 | 554 |
591 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ | 555 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ |
OLD | NEW |