Refactor RtpSender to take the sender ID as a constructor argument
This change also standardizes the RtpSender to a single constructor
and moves the |track| and |stream_ids| arguments to setter methods.
Bug: webrtc:8734
Change-Id: I227a84868a80797f6cc2a1af6eec6d76da8ea159
Reviewed-on: https://webrtc-review.googlesource.com/84248
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23730}
diff --git a/pc/rtpsenderreceiver_unittest.cc b/pc/rtpsenderreceiver_unittest.cc
index 985fa06..5795ba7 100644
--- a/pc/rtpsenderreceiver_unittest.cc
+++ b/pc/rtpsenderreceiver_unittest.cc
@@ -147,8 +147,9 @@
audio_track_ = AudioTrack::Create(kAudioTrackId, source);
EXPECT_TRUE(local_stream_->AddTrack(audio_track_));
audio_rtp_sender_ =
- new AudioRtpSender(worker_thread_, local_stream_->GetAudioTracks()[0],
- {local_stream_->id()}, nullptr);
+ new AudioRtpSender(worker_thread_, audio_track_->id(), nullptr);
+ ASSERT_TRUE(audio_rtp_sender_->SetTrack(audio_track_));
+ audio_rtp_sender_->set_stream_ids({local_stream_->id()});
audio_rtp_sender_->SetVoiceMediaChannel(voice_media_channel_);
audio_rtp_sender_->SetSsrc(kAudioSsrc);
audio_rtp_sender_->GetOnDestroyedSignal()->connect(
@@ -157,7 +158,7 @@
}
void CreateAudioRtpSenderWithNoTrack() {
- audio_rtp_sender_ = new AudioRtpSender(worker_thread_, nullptr);
+ audio_rtp_sender_ = new AudioRtpSender(worker_thread_, /*id=*/"", nullptr);
audio_rtp_sender_->SetVoiceMediaChannel(voice_media_channel_);
}
@@ -171,16 +172,16 @@
void CreateVideoRtpSender(bool is_screencast, uint32_t ssrc = kVideoSsrc) {
AddVideoTrack(is_screencast);
- video_rtp_sender_ =
- new VideoRtpSender(worker_thread_, local_stream_->GetVideoTracks()[0],
- {local_stream_->id()});
+ video_rtp_sender_ = new VideoRtpSender(worker_thread_, video_track_->id());
+ ASSERT_TRUE(video_rtp_sender_->SetTrack(video_track_));
+ video_rtp_sender_->set_stream_ids({local_stream_->id()});
video_rtp_sender_->SetVideoMediaChannel(video_media_channel_);
video_rtp_sender_->SetSsrc(ssrc);
VerifyVideoChannelInput(ssrc);
}
void CreateVideoRtpSenderWithNoTrack() {
- video_rtp_sender_ = new VideoRtpSender(worker_thread_);
+ video_rtp_sender_ = new VideoRtpSender(worker_thread_, /*id=*/"");
video_rtp_sender_->SetVideoMediaChannel(video_media_channel_);
}
@@ -1128,9 +1129,9 @@
// Setting detailed overrides the default non-screencast mode. This should be
// applied even if the track is set on construction.
video_track_->set_content_hint(VideoTrackInterface::ContentHint::kDetailed);
- video_rtp_sender_ =
- new VideoRtpSender(worker_thread_, local_stream_->GetVideoTracks()[0],
- {local_stream_->id()});
+ video_rtp_sender_ = new VideoRtpSender(worker_thread_, video_track_->id());
+ ASSERT_TRUE(video_rtp_sender_->SetTrack(video_track_));
+ video_rtp_sender_->set_stream_ids({local_stream_->id()});
video_rtp_sender_->SetVideoMediaChannel(video_media_channel_);
video_track_->set_enabled(true);