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 12 matching lines...) Expand all Loading... |
23 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" | 23 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" |
24 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 24 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
25 #include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer_d
efines.h" | 25 #include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer_d
efines.h" |
26 #include "webrtc/modules/audio_processing/rms_level.h" | 26 #include "webrtc/modules/audio_processing/rms_level.h" |
27 #include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h" | 27 #include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h" |
28 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 28 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
29 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 29 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
30 #include "webrtc/voice_engine/audio_level.h" | 30 #include "webrtc/voice_engine/audio_level.h" |
31 #include "webrtc/voice_engine/file_player.h" | 31 #include "webrtc/voice_engine/file_player.h" |
32 #include "webrtc/voice_engine/file_recorder.h" | 32 #include "webrtc/voice_engine/file_recorder.h" |
33 #include "webrtc/voice_engine/include/voe_audio_processing.h" | |
34 #include "webrtc/voice_engine/include/voe_base.h" | 33 #include "webrtc/voice_engine/include/voe_base.h" |
35 #include "webrtc/voice_engine/include/voe_network.h" | 34 #include "webrtc/voice_engine/include/voe_network.h" |
36 #include "webrtc/voice_engine/shared_data.h" | 35 #include "webrtc/voice_engine/shared_data.h" |
37 #include "webrtc/voice_engine/voice_engine_defines.h" | 36 #include "webrtc/voice_engine/voice_engine_defines.h" |
38 | 37 |
39 namespace rtc { | 38 namespace rtc { |
40 class TimestampWrapAroundHandler; | 39 class TimestampWrapAroundHandler; |
41 } | 40 } |
42 | 41 |
43 namespace webrtc { | 42 namespace webrtc { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 }; | 126 }; |
128 | 127 |
129 class Channel | 128 class Channel |
130 : public RtpData, | 129 : public RtpData, |
131 public RtpFeedback, | 130 public RtpFeedback, |
132 public FileCallback, // receiving notification from file player & | 131 public FileCallback, // receiving notification from file player & |
133 // recorder | 132 // recorder |
134 public Transport, | 133 public Transport, |
135 public AudioPacketizationCallback, // receive encoded packets from the | 134 public AudioPacketizationCallback, // receive encoded packets from the |
136 // ACM | 135 // ACM |
137 public ACMVADCallback, // receive voice activity from the ACM | |
138 public MixerParticipant, // supplies output mixer with audio frames | 136 public MixerParticipant, // supplies output mixer with audio frames |
139 public OverheadObserver { | 137 public OverheadObserver { |
140 public: | 138 public: |
141 friend class VoERtcpObserver; | 139 friend class VoERtcpObserver; |
142 | 140 |
143 enum { KNumSocketThreads = 1 }; | 141 enum { KNumSocketThreads = 1 }; |
144 enum { KNumberOfSocketBuffers = 8 }; | 142 enum { KNumberOfSocketBuffers = 8 }; |
145 virtual ~Channel(); | 143 virtual ~Channel(); |
146 static int32_t CreateChannel( | 144 static int32_t CreateChannel( |
147 Channel*& channel, | 145 Channel*& channel, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // Audio+Video Sync | 256 // Audio+Video Sync |
259 uint32_t GetDelayEstimate() const; | 257 uint32_t GetDelayEstimate() const; |
260 int SetMinimumPlayoutDelay(int delayMs); | 258 int SetMinimumPlayoutDelay(int delayMs); |
261 int GetPlayoutTimestamp(unsigned int& timestamp); | 259 int GetPlayoutTimestamp(unsigned int& timestamp); |
262 int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const; | 260 int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const; |
263 | 261 |
264 // DTMF | 262 // DTMF |
265 int SendTelephoneEventOutband(int event, int duration_ms); | 263 int SendTelephoneEventOutband(int event, int duration_ms); |
266 int SetSendTelephoneEventPayloadType(int payload_type, int payload_frequency); | 264 int SetSendTelephoneEventPayloadType(int payload_type, int payload_frequency); |
267 | 265 |
268 // VoEAudioProcessingImpl | |
269 int VoiceActivityIndicator(int& activity); | |
270 | |
271 // VoERTP_RTCP | 266 // VoERTP_RTCP |
272 int SetLocalSSRC(unsigned int ssrc); | 267 int SetLocalSSRC(unsigned int ssrc); |
273 int GetLocalSSRC(unsigned int& ssrc); | 268 int GetLocalSSRC(unsigned int& ssrc); |
274 int GetRemoteSSRC(unsigned int& ssrc); | 269 int GetRemoteSSRC(unsigned int& ssrc); |
275 int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id); | 270 int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id); |
276 int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id); | 271 int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id); |
277 void EnableSendTransportSequenceNumber(int id); | 272 void EnableSendTransportSequenceNumber(int id); |
278 void EnableReceiveTransportSequenceNumber(int id); | 273 void EnableReceiveTransportSequenceNumber(int id); |
279 | 274 |
280 void RegisterSenderCongestionControlObjects( | 275 void RegisterSenderCongestionControlObjects( |
(...skipping 19 matching lines...) Expand all Loading... |
300 void SetNACKStatus(bool enable, int maxNumberOfPackets); | 295 void SetNACKStatus(bool enable, int maxNumberOfPackets); |
301 | 296 |
302 // From AudioPacketizationCallback in the ACM | 297 // From AudioPacketizationCallback in the ACM |
303 int32_t SendData(FrameType frameType, | 298 int32_t SendData(FrameType frameType, |
304 uint8_t payloadType, | 299 uint8_t payloadType, |
305 uint32_t timeStamp, | 300 uint32_t timeStamp, |
306 const uint8_t* payloadData, | 301 const uint8_t* payloadData, |
307 size_t payloadSize, | 302 size_t payloadSize, |
308 const RTPFragmentationHeader* fragmentation) override; | 303 const RTPFragmentationHeader* fragmentation) override; |
309 | 304 |
310 // From ACMVADCallback in the ACM | |
311 int32_t InFrameType(FrameType frame_type) override; | |
312 | |
313 // From RtpData in the RTP/RTCP module | 305 // From RtpData in the RTP/RTCP module |
314 int32_t OnReceivedPayloadData(const uint8_t* payloadData, | 306 int32_t OnReceivedPayloadData(const uint8_t* payloadData, |
315 size_t payloadSize, | 307 size_t payloadSize, |
316 const WebRtcRTPHeader* rtpHeader) override; | 308 const WebRtcRTPHeader* rtpHeader) override; |
317 bool OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override; | 309 bool OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override; |
318 | 310 |
319 // From RtpFeedback in the RTP/RTCP module | 311 // From RtpFeedback in the RTP/RTCP module |
320 int32_t OnInitializeDecoder(int8_t payloadType, | 312 int32_t OnInitializeDecoder(int8_t payloadType, |
321 const char payloadName[RTP_PAYLOAD_NAME_SIZE], | 313 const char payloadName[RTP_PAYLOAD_NAME_SIZE], |
322 int frequency, | 314 int frequency, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 int _inputFilePlayerId; | 441 int _inputFilePlayerId; |
450 int _outputFilePlayerId; | 442 int _outputFilePlayerId; |
451 int _outputFileRecorderId; | 443 int _outputFileRecorderId; |
452 bool _outputFileRecording; | 444 bool _outputFileRecording; |
453 uint32_t _timeStamp; | 445 uint32_t _timeStamp; |
454 | 446 |
455 RemoteNtpTimeEstimator ntp_estimator_ GUARDED_BY(ts_stats_lock_); | 447 RemoteNtpTimeEstimator ntp_estimator_ GUARDED_BY(ts_stats_lock_); |
456 | 448 |
457 // Timestamp of the audio pulled from NetEq. | 449 // Timestamp of the audio pulled from NetEq. |
458 rtc::Optional<uint32_t> jitter_buffer_playout_timestamp_; | 450 rtc::Optional<uint32_t> jitter_buffer_playout_timestamp_; |
| 451 |
| 452 rtc::CriticalSection video_sync_lock_; |
459 uint32_t playout_timestamp_rtp_ GUARDED_BY(video_sync_lock_); | 453 uint32_t playout_timestamp_rtp_ GUARDED_BY(video_sync_lock_); |
460 uint32_t playout_delay_ms_ GUARDED_BY(video_sync_lock_); | 454 uint32_t playout_delay_ms_ GUARDED_BY(video_sync_lock_); |
461 uint16_t send_sequence_number_; | 455 uint16_t send_sequence_number_; |
462 uint8_t restored_packet_[kVoiceEngineMaxIpPacketSizeBytes]; | 456 uint8_t restored_packet_[kVoiceEngineMaxIpPacketSizeBytes]; |
463 | 457 |
464 rtc::CriticalSection ts_stats_lock_; | 458 rtc::CriticalSection ts_stats_lock_; |
465 | 459 |
466 std::unique_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_; | 460 std::unique_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_; |
467 // The rtp timestamp of the first played out audio frame. | 461 // The rtp timestamp of the first played out audio frame. |
468 int64_t capture_start_rtp_time_stamp_; | 462 int64_t capture_start_rtp_time_stamp_; |
469 // The capture ntp time (in local timebase) of the first played out audio | 463 // The capture ntp time (in local timebase) of the first played out audio |
470 // frame. | 464 // frame. |
471 int64_t capture_start_ntp_time_ms_ GUARDED_BY(ts_stats_lock_); | 465 int64_t capture_start_ntp_time_ms_ GUARDED_BY(ts_stats_lock_); |
472 | 466 |
473 // uses | 467 // uses |
474 Statistics* _engineStatisticsPtr; | 468 Statistics* _engineStatisticsPtr; |
475 OutputMixer* _outputMixerPtr; | 469 OutputMixer* _outputMixerPtr; |
476 ProcessThread* _moduleProcessThreadPtr; | 470 ProcessThread* _moduleProcessThreadPtr; |
477 AudioDeviceModule* _audioDeviceModulePtr; | 471 AudioDeviceModule* _audioDeviceModulePtr; |
478 VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base | 472 VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base |
479 rtc::CriticalSection* _callbackCritSectPtr; // owned by base | 473 rtc::CriticalSection* _callbackCritSectPtr; // owned by base |
480 Transport* _transportPtr; // WebRtc socket or external transport | 474 Transport* _transportPtr; // WebRtc socket or external transport |
481 RmsLevel rms_level_; | 475 RmsLevel rms_level_; |
482 int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise | |
483 bool input_mute_ GUARDED_BY(volume_settings_critsect_); | 476 bool input_mute_ GUARDED_BY(volume_settings_critsect_); |
484 bool previous_frame_muted_; // Only accessed from PrepareEncodeAndSend(). | 477 bool previous_frame_muted_; // Only accessed from PrepareEncodeAndSend(). |
485 float _outputGain GUARDED_BY(volume_settings_critsect_); | 478 float _outputGain GUARDED_BY(volume_settings_critsect_); |
486 // VoEBase | 479 // VoEBase |
487 bool _mixFileWithMicrophone; | 480 bool _mixFileWithMicrophone; |
488 // VoeRTP_RTCP | 481 // VoeRTP_RTCP |
489 uint32_t _lastLocalTimeStamp; | 482 uint32_t _lastLocalTimeStamp; |
490 int8_t _lastPayloadType; | 483 int8_t _lastPayloadType; |
491 bool _includeAudioLevelIndication; | 484 bool _includeAudioLevelIndication; |
492 size_t transport_overhead_per_packet_ GUARDED_BY(overhead_per_packet_lock_); | 485 size_t transport_overhead_per_packet_ GUARDED_BY(overhead_per_packet_lock_); |
493 size_t rtp_overhead_per_packet_ GUARDED_BY(overhead_per_packet_lock_); | 486 size_t rtp_overhead_per_packet_ GUARDED_BY(overhead_per_packet_lock_); |
494 rtc::CriticalSection overhead_per_packet_lock_; | 487 rtc::CriticalSection overhead_per_packet_lock_; |
495 // VoENetwork | 488 // VoENetwork |
496 AudioFrame::SpeechType _outputSpeechType; | 489 AudioFrame::SpeechType _outputSpeechType; |
497 // VoEVideoSync | 490 // DTX. |
498 rtc::CriticalSection video_sync_lock_; | |
499 // VoEAudioProcessing | |
500 bool restored_packet_in_use_; | 491 bool restored_packet_in_use_; |
501 // RtcpBandwidthObserver | 492 // RtcpBandwidthObserver |
502 std::unique_ptr<VoERtcpObserver> rtcp_observer_; | 493 std::unique_ptr<VoERtcpObserver> rtcp_observer_; |
503 // An associated send channel. | 494 // An associated send channel. |
504 rtc::CriticalSection assoc_send_channel_lock_; | 495 rtc::CriticalSection assoc_send_channel_lock_; |
505 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); | 496 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); |
506 | 497 |
507 bool pacing_enabled_; | 498 bool pacing_enabled_; |
508 PacketRouter* packet_router_ = nullptr; | 499 PacketRouter* packet_router_ = nullptr; |
509 std::unique_ptr<TransportFeedbackProxy> feedback_observer_proxy_; | 500 std::unique_ptr<TransportFeedbackProxy> feedback_observer_proxy_; |
510 std::unique_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_; | 501 std::unique_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_; |
511 std::unique_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_; | 502 std::unique_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_; |
512 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; | 503 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; |
513 | 504 |
514 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. | 505 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. |
515 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 506 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
516 }; | 507 }; |
517 | 508 |
518 } // namespace voe | 509 } // namespace voe |
519 } // namespace webrtc | 510 } // namespace webrtc |
520 | 511 |
521 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ | 512 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ |
OLD | NEW |