Delete ChannelSend::RegisterTransport, replacing by construction argument

Bug: webrtc:9719
Change-Id: If3960de660cfa7a65c8bf9375ceb0af0a67d376c
Reviewed-on: https://webrtc-review.googlesource.com/c/111256
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25784}
This commit is contained in:
Niels Möller
2018-11-26 10:55:07 +01:00
committed by Commit Bot
parent b2533031a0
commit e97719974b
5 changed files with 14 additions and 20 deletions

View File

@ -111,6 +111,7 @@ AudioSendStream::AudioSendStream(
voe::CreateChannelSend(worker_queue,
module_process_thread,
config.media_transport,
config.send_transport,
rtcp_rtt_stats,
event_log,
config.frame_encryptor,
@ -171,7 +172,6 @@ AudioSendStream::~AudioSendStream() {
RTC_DCHECK(!sending_);
if (rtp_transport_) {
rtp_transport_->DeRegisterPacketFeedbackObserver(this);
channel_send_->RegisterTransport(nullptr);
channel_send_->ResetSenderCongestionControlObjects();
}
}
@ -214,6 +214,10 @@ void AudioSendStream::ConfigureStream(
const auto& channel_send = stream->channel_send_;
const auto& old_config = stream->config_;
// Configuration parameters which cannot be changed.
RTC_DCHECK(first_time ||
old_config.send_transport == new_config.send_transport);
if (first_time || old_config.rtp.ssrc != new_config.rtp.ssrc) {
channel_send->SetLocalSSRC(new_config.rtp.ssrc);
if (stream->suspended_rtp_state_) {
@ -224,10 +228,6 @@ void AudioSendStream::ConfigureStream(
channel_send->SetRTCP_CNAME(new_config.rtp.c_name);
}
if (first_time || new_config.send_transport != old_config.send_transport) {
channel_send->RegisterTransport(new_config.send_transport);
}
// Enable the frame encryptor if a new frame encryptor has been provided.
if (first_time || new_config.frame_encryptor != old_config.frame_encryptor) {
channel_send->SetFrameEncryptor(new_config.frame_encryptor);

View File

@ -211,7 +211,6 @@ struct ConfigHelper {
.Times(1);
}
EXPECT_CALL(*channel_send_, ResetSenderCongestionControlObjects()).Times(1);
EXPECT_CALL(*channel_send_, RegisterTransport(nullptr)).Times(2);
}
void SetupMockForSetupSendCodec(bool expect_set_encoder_call) {

View File

@ -91,6 +91,7 @@ class ChannelSend
ChannelSend(rtc::TaskQueue* encoder_queue,
ProcessThread* module_process_thread,
MediaTransportInterface* media_transport,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
FrameEncryptorInterface* frame_encryptor,
@ -115,7 +116,6 @@ class ChannelSend
int GetBitrate() const override;
// Network
void RegisterTransport(Transport* transport) override;
bool ReceivedRTCPPacket(const uint8_t* data, size_t length) override;
// Muting, Volume and Level.
@ -254,7 +254,7 @@ class ChannelSend
// uses
ProcessThread* const _moduleProcessThreadPtr;
Transport* _transportPtr; // WebRtc socket or external transport
Transport* const _transportPtr; // WebRtc socket or external transport
RmsLevel rms_level_ RTC_GUARDED_BY(encoder_queue_);
bool input_mute_ RTC_GUARDED_BY(volume_settings_critsect_);
bool previous_frame_muted_ RTC_GUARDED_BY(encoder_queue_);
@ -683,6 +683,7 @@ bool ChannelSend::SendRtcp(const uint8_t* data, size_t len) {
ChannelSend::ChannelSend(rtc::TaskQueue* encoder_queue,
ProcessThread* module_process_thread,
MediaTransportInterface* media_transport,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
FrameEncryptorInterface* frame_encryptor,
@ -694,7 +695,7 @@ ChannelSend::ChannelSend(rtc::TaskQueue* encoder_queue,
// random offset
send_sequence_number_(0),
_moduleProcessThreadPtr(module_process_thread),
_transportPtr(NULL),
_transportPtr(rtp_transport),
input_mute_(false),
previous_frame_muted_(false),
_includeAudioLevelIndication(false),
@ -953,12 +954,6 @@ void ChannelSend::OnUplinkPacketLossRate(float packet_loss_rate) {
});
}
void ChannelSend::RegisterTransport(Transport* transport) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
rtc::CritScope cs(&_callbackCritSect);
_transportPtr = transport;
}
// TODO(nisse): Delete always-true return value.
bool ChannelSend::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
// May be called on either worker thread or network thread.
@ -1344,6 +1339,7 @@ std::unique_ptr<ChannelSendInterface> CreateChannelSend(
rtc::TaskQueue* encoder_queue,
ProcessThread* module_process_thread,
MediaTransportInterface* media_transport,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
FrameEncryptorInterface* frame_encryptor,
@ -1351,9 +1347,9 @@ std::unique_ptr<ChannelSendInterface> CreateChannelSend(
bool extmap_allow_mixed,
int rtcp_report_interval_ms) {
return absl::make_unique<ChannelSend>(
encoder_queue, module_process_thread, media_transport, rtcp_rtt_stats,
rtc_event_log, frame_encryptor, crypto_options, extmap_allow_mixed,
rtcp_report_interval_ms);
encoder_queue, module_process_thread, media_transport, rtp_transport,
rtcp_rtt_stats, rtc_event_log, frame_encryptor, crypto_options,
extmap_allow_mixed, rtcp_report_interval_ms);
}
} // namespace voe

View File

@ -55,7 +55,6 @@ class ChannelSendInterface {
public:
virtual ~ChannelSendInterface() = default;
virtual void RegisterTransport(Transport* transport) = 0;
virtual bool ReceivedRTCPPacket(const uint8_t* packet, size_t length) = 0;
virtual CallSendStatistics GetRTCPStatistics() const = 0;
@ -115,6 +114,7 @@ std::unique_ptr<ChannelSendInterface> CreateChannelSend(
rtc::TaskQueue* encoder_queue,
ProcessThread* module_process_thread,
MediaTransportInterface* media_transport,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
FrameEncryptorInterface* frame_encryptor,

View File

@ -90,7 +90,6 @@ class MockChannelSend : public voe::ChannelSendInterface {
MOCK_METHOD2(SendTelephoneEventOutband, bool(int event, int duration_ms));
MOCK_METHOD1(OnBitrateAllocation, void(BitrateAllocationUpdate update));
MOCK_METHOD1(SetInputMute, void(bool muted));
MOCK_METHOD1(RegisterTransport, void(Transport* transport));
MOCK_METHOD2(ReceivedRTCPPacket, bool(const uint8_t* packet, size_t length));
// GMock doesn't like move-only types, like std::unique_ptr.
virtual void ProcessAndEncodeAudio(std::unique_ptr<AudioFrame> audio_frame) {