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 |
11 #ifndef WEBRTC_VOICE_ENGINE_CHANNEL_H_ | 11 #ifndef WEBRTC_VOICE_ENGINE_CHANNEL_H_ |
12 #define WEBRTC_VOICE_ENGINE_CHANNEL_H_ | 12 #define WEBRTC_VOICE_ENGINE_CHANNEL_H_ |
13 | 13 |
14 #include "webrtc/base/criticalsection.h" | |
14 #include "webrtc/base/scoped_ptr.h" | 15 #include "webrtc/base/scoped_ptr.h" |
16 #include "webrtc/call/congestion_controller.h" | |
15 #include "webrtc/common_audio/resampler/include/push_resampler.h" | 17 #include "webrtc/common_audio/resampler/include/push_resampler.h" |
16 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
17 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 19 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
18 #include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer_d efines.h" | 20 #include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer_d efines.h" |
19 #include "webrtc/modules/audio_processing/rms_level.h" | 21 #include "webrtc/modules/audio_processing/rms_level.h" |
20 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 22 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
23 #include "webrtc/modules/pacing/paced_sender.h" | |
24 #include "webrtc/modules/pacing/packet_router.h" | |
21 #include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h" | 25 #include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h" |
22 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
24 #include "webrtc/modules/utility/include/file_player.h" | 28 #include "webrtc/modules/utility/include/file_player.h" |
25 #include "webrtc/modules/utility/include/file_recorder.h" | 29 #include "webrtc/modules/utility/include/file_recorder.h" |
26 #include "webrtc/voice_engine/dtmf_inband.h" | 30 #include "webrtc/voice_engine/dtmf_inband.h" |
27 #include "webrtc/voice_engine/dtmf_inband_queue.h" | 31 #include "webrtc/voice_engine/dtmf_inband_queue.h" |
28 #include "webrtc/voice_engine/include/voe_audio_processing.h" | 32 #include "webrtc/voice_engine/include/voe_audio_processing.h" |
29 #include "webrtc/voice_engine/include/voe_network.h" | 33 #include "webrtc/voice_engine/include/voe_network.h" |
30 #include "webrtc/voice_engine/level_indicator.h" | 34 #include "webrtc/voice_engine/level_indicator.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 struct SenderInfo; | 70 struct SenderInfo; |
67 | 71 |
68 namespace voe { | 72 namespace voe { |
69 | 73 |
70 class OutputMixer; | 74 class OutputMixer; |
71 class Statistics; | 75 class Statistics; |
72 class StatisticsProxy; | 76 class StatisticsProxy; |
73 class TransmitMixer; | 77 class TransmitMixer; |
74 class VoERtcpObserver; | 78 class VoERtcpObserver; |
75 | 79 |
80 class PacketSenderProxy : public RtpPacketSender, | |
the sun
2015/11/30 12:37:20
You can put this class in an anonymous namespace i
stefan-webrtc
2015/11/30 15:22:02
Done.
| |
81 public TransportFeedbackObserver, | |
82 public TransportSequenceNumberAllocator { | |
83 public: | |
84 void SetCongestionControlObjects( | |
85 RtpPacketSender* rtp_packet_sender, | |
86 TransportFeedbackObserver* transport_feedback_observer, | |
87 TransportSequenceNumberAllocator* seq_num_allocator) { | |
88 rtc::CritScope lock(&crit_); | |
89 packet_sender_ = rtp_packet_sender; | |
90 feedback_observer_ = transport_feedback_observer; | |
91 seq_num_allocator_ = seq_num_allocator; | |
92 } | |
93 | |
94 // Implements RtpPacketSender. | |
95 void InsertPacket(Priority priority, | |
96 uint32_t ssrc, | |
97 uint16_t sequence_number, | |
98 int64_t capture_time_ms, | |
99 size_t bytes, | |
100 bool retransmission) override { | |
101 rtc::CritScope lock(&crit_); | |
102 if (packet_sender_ == nullptr) | |
the sun
2015/11/30 12:37:20
Looks like you have a crash bug here; packet_sende
stefan-webrtc
2015/11/30 15:22:02
Definitely could crash here, good catch.
| |
103 return; | |
104 packet_sender_->InsertPacket(priority, ssrc, sequence_number, | |
105 capture_time_ms, bytes, retransmission); | |
106 } | |
107 | |
108 // Implements TransportFeedbackObserver. | |
109 void AddPacket(uint16_t sequence_number, | |
the sun
2015/11/30 12:37:20
I don't see where this is called from? Where is it
stefan-webrtc
2015/11/30 15:22:02
Here: https://code.google.com/p/chromium/codesearc
the sun
2015/12/01 10:25:36
Yes, but I don't see how transport_feedback_observ
stefan-webrtc
2015/12/01 16:19:33
Gooood catch. :)
It would have been caught later
the sun
2015/12/01 16:48:23
Is it possible to add a test? At some level?
stefan-webrtc
2015/12/02 16:14:17
It is, but it requires setting up a call and monit
stefan-webrtc
2015/12/02 16:17:39
https://code.google.com/p/chromium/codesearch#chro
| |
110 size_t length, | |
111 bool was_paced) override { | |
112 rtc::CritScope lock(&crit_); | |
113 if (feedback_observer_ == nullptr) | |
114 return; | |
115 feedback_observer_->AddPacket(sequence_number, length, was_paced); | |
116 } | |
117 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override { | |
118 rtc::CritScope lock(&crit_); | |
119 if (feedback_observer_ == nullptr) | |
120 return; | |
121 feedback_observer_->OnTransportFeedback(feedback); | |
122 } | |
123 | |
124 // Implements TransportSequenceNumberAllocator. | |
125 uint16_t AllocateSequenceNumber() override { | |
126 rtc::CritScope lock(&crit_); | |
127 RTC_DCHECK(seq_num_allocator_); | |
128 return seq_num_allocator_->AllocateSequenceNumber(); | |
129 } | |
130 | |
131 private: | |
132 rtc::CriticalSection crit_; | |
the sun
2015/11/30 12:37:20
So what are the threads this can be called on? Ple
stefan-webrtc
2015/11/30 15:22:02
Done.
| |
133 RtpPacketSender* packet_sender_ GUARDED_BY(&crit_); | |
134 TransportFeedbackObserver* feedback_observer_ GUARDED_BY(&crit_); | |
135 TransportSequenceNumberAllocator* seq_num_allocator_ GUARDED_BY(&crit_); | |
136 }; | |
137 | |
76 // Helper class to simplify locking scheme for members that are accessed from | 138 // Helper class to simplify locking scheme for members that are accessed from |
77 // multiple threads. | 139 // multiple threads. |
78 // Example: a member can be set on thread T1 and read by an internal audio | 140 // Example: a member can be set on thread T1 and read by an internal audio |
79 // thread T2. Accessing the member via this class ensures that we are | 141 // thread T2. Accessing the member via this class ensures that we are |
80 // safe and also avoid TSan v2 warnings. | 142 // safe and also avoid TSan v2 warnings. |
81 class ChannelState { | 143 class ChannelState { |
82 public: | 144 public: |
83 struct State { | 145 struct State { |
84 State() : rx_apm_is_enabled(false), | 146 State() : rx_apm_is_enabled(false), |
85 input_external_media(false), | 147 input_external_media(false), |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 #endif | 376 #endif |
315 | 377 |
316 // VoERTP_RTCP | 378 // VoERTP_RTCP |
317 int SetLocalSSRC(unsigned int ssrc); | 379 int SetLocalSSRC(unsigned int ssrc); |
318 int GetLocalSSRC(unsigned int& ssrc); | 380 int GetLocalSSRC(unsigned int& ssrc); |
319 int GetRemoteSSRC(unsigned int& ssrc); | 381 int GetRemoteSSRC(unsigned int& ssrc); |
320 int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id); | 382 int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id); |
321 int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id); | 383 int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id); |
322 int SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id); | 384 int SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id); |
323 int SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id); | 385 int SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id); |
386 void SetSendTransportSequenceNumber(int id); | |
387 | |
388 void SetCongestionControlObjects( | |
389 RtpPacketSender* rtp_packet_sender, | |
390 TransportFeedbackObserver* transport_feedback_observer, | |
391 PacketRouter* packet_router); | |
392 | |
324 void SetRTCPStatus(bool enable); | 393 void SetRTCPStatus(bool enable); |
325 int GetRTCPStatus(bool& enabled); | 394 int GetRTCPStatus(bool& enabled); |
326 int SetRTCP_CNAME(const char cName[256]); | 395 int SetRTCP_CNAME(const char cName[256]); |
327 int GetRemoteRTCP_CNAME(char cName[256]); | 396 int GetRemoteRTCP_CNAME(char cName[256]); |
328 int GetRemoteRTCPData(unsigned int& NTPHigh, unsigned int& NTPLow, | 397 int GetRemoteRTCPData(unsigned int& NTPHigh, unsigned int& NTPLow, |
329 unsigned int& timestamp, | 398 unsigned int& timestamp, |
330 unsigned int& playoutTimestamp, unsigned int* jitter, | 399 unsigned int& playoutTimestamp, unsigned int* jitter, |
331 unsigned short* fractionLost); | 400 unsigned short* fractionLost); |
332 int SendApplicationDefinedRTCPPacket(unsigned char subType, | 401 int SendApplicationDefinedRTCPPacket(unsigned char subType, |
333 unsigned int name, const char* data, | 402 unsigned int name, const char* data, |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 bool _RxVadDetection; | 646 bool _RxVadDetection; |
578 bool _rxAgcIsEnabled; | 647 bool _rxAgcIsEnabled; |
579 bool _rxNsIsEnabled; | 648 bool _rxNsIsEnabled; |
580 bool restored_packet_in_use_; | 649 bool restored_packet_in_use_; |
581 // RtcpBandwidthObserver | 650 // RtcpBandwidthObserver |
582 rtc::scoped_ptr<VoERtcpObserver> rtcp_observer_; | 651 rtc::scoped_ptr<VoERtcpObserver> rtcp_observer_; |
583 rtc::scoped_ptr<NetworkPredictor> network_predictor_; | 652 rtc::scoped_ptr<NetworkPredictor> network_predictor_; |
584 // An associated send channel. | 653 // An associated send channel. |
585 rtc::scoped_ptr<CriticalSectionWrapper> assoc_send_channel_lock_; | 654 rtc::scoped_ptr<CriticalSectionWrapper> assoc_send_channel_lock_; |
586 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); | 655 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); |
656 | |
657 rtc::scoped_ptr<PacketSenderProxy> packet_sender_proxy_; | |
658 PacketRouter* packet_router_; | |
587 }; | 659 }; |
588 | 660 |
589 } // namespace voe | 661 } // namespace voe |
590 } // namespace webrtc | 662 } // namespace webrtc |
591 | 663 |
592 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ | 664 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ |
OLD | NEW |