Prevent channels being set on stopped transceiver.
Fixing bug that allows a channel to be set on a stopped transceiver.
This CL contains the following refactoring:
1. Extracted ChannelInterface from BaseChannel
2. Unified SetXxxMediaChannel (Voice, Video) into SetMediaChannel
Bug: webrtc:9932
Change-Id: I2fbf00c823b7848ad4f2acb6e80b1b58ac45ee38
Reviewed-on: https://webrtc-review.googlesource.com/c/110564
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25641}
diff --git a/pc/rtpreceiver.cc b/pc/rtpreceiver.cc
index acea930..1916a73 100644
--- a/pc/rtpreceiver.cc
+++ b/pc/rtpreceiver.cc
@@ -268,9 +268,10 @@
}
}
-void AudioRtpReceiver::SetVoiceMediaChannel(
- cricket::VoiceMediaChannel* voice_media_channel) {
- media_channel_ = voice_media_channel;
+void AudioRtpReceiver::SetMediaChannel(cricket::MediaChannel* media_channel) {
+ RTC_DCHECK(media_channel == nullptr ||
+ media_channel->media_type() == media_type());
+ media_channel_ = static_cast<cricket::VoiceMediaChannel*>(media_channel);
}
void AudioRtpReceiver::NotifyFirstPacketReceived() {
@@ -443,9 +444,10 @@
}
}
-void VideoRtpReceiver::SetVideoMediaChannel(
- cricket::VideoMediaChannel* video_media_channel) {
- media_channel_ = video_media_channel;
+void VideoRtpReceiver::SetMediaChannel(cricket::MediaChannel* media_channel) {
+ RTC_DCHECK(media_channel == nullptr ||
+ media_channel->media_type() == media_type());
+ media_channel_ = static_cast<cricket::VideoMediaChannel*>(media_channel);
}
void VideoRtpReceiver::NotifyFirstPacketReceived() {