Add streams() to RtpReceiverInterface and implementations.
This makes the receiver know about its associated set of streams, the
equivalent of the [[AssociatedRemoteMediaStreams]] slot in the spec,
https://w3c.github.io/webrtc-pc/#dfn-x%5B%5Bassociatedremotemediastreams%5D%5D
This does not change layers below peerconnection.cc. The streams are set
upon the receiver's construction and is not modified for the duration of
its lifetime.
When we support modifying the associated set of streams of a receiver
the receiver needs to know about it. The receiver's streams() should be
used in all places where a receiver's streams need to be known.
Bug: webrtc:8473
Change-Id: I31202973aed98e61fa9b6a78b52e815227b6c17d
Reviewed-on: https://webrtc-review.googlesource.com/22922
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20825}diff --git a/pc/rtpsenderreceiver_unittest.cc b/pc/rtpsenderreceiver_unittest.cc
index f5b06d1..03bb84b 100644
--- a/pc/rtpsenderreceiver_unittest.cc
+++ b/pc/rtpsenderreceiver_unittest.cc
@@ -165,16 +165,19 @@
VerifyVideoChannelNoInput();
}
- void CreateAudioRtpReceiver() {
- audio_rtp_receiver_ =
- new AudioRtpReceiver(kAudioTrackId, kAudioSsrc, voice_channel_);
+ void CreateAudioRtpReceiver(
+ std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams = {}) {
+ audio_rtp_receiver_ = new AudioRtpReceiver(
+ kAudioTrackId, std::move(streams), kAudioSsrc, voice_channel_);
audio_track_ = audio_rtp_receiver_->audio_track();
VerifyVoiceChannelOutput();
}
- void CreateVideoRtpReceiver() {
+ void CreateVideoRtpReceiver(
+ std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams = {}) {
video_rtp_receiver_ = new VideoRtpReceiver(
- kVideoTrackId, rtc::Thread::Current(), kVideoSsrc, video_channel_);
+ kVideoTrackId, std::move(streams), rtc::Thread::Current(), kVideoSsrc,
+ video_channel_);
video_track_ = video_rtp_receiver_->video_track();
VerifyVideoChannelOutput();
}
@@ -292,6 +295,16 @@
DestroyVideoRtpReceiver();
}
+TEST_F(RtpSenderReceiverTest, AddAndDestroyAudioRtpReceiverWithStreams) {
+ CreateAudioRtpReceiver({local_stream_});
+ DestroyAudioRtpReceiver();
+}
+
+TEST_F(RtpSenderReceiverTest, AddAndDestroyVideoRtpReceiverWithStreams) {
+ CreateVideoRtpReceiver({local_stream_});
+ DestroyVideoRtpReceiver();
+}
+
// Test that the AudioRtpSender applies options from the local audio source.
TEST_F(RtpSenderReceiverTest, LocalAudioSourceOptionsApplied) {
cricket::AudioOptions options;