Separate setting a cricket::Channel from clearing the channel.

This makes it clearer which modules set the channel.
Also remove GetChannel() from PeerConnection public API

This was only used once, internally, and can better be inlined.
Part of reducing the exposure of Channel.

Bug: webrtc:13931
Change-Id: I5f44865230a0d8314d269c85afb91d4b503e8de0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260187
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36695}
This commit is contained in:
Harald Alvestrand
2022-04-28 13:31:17 +00:00
committed by WebRTC LUCI CQ
parent 90623e1a91
commit 19ebabc904
7 changed files with 90 additions and 60 deletions

View File

@ -83,7 +83,7 @@ TEST(RtpTransceiverTest, CannotSetChannelOnStoppedTransceiver) {
// Clear the current channel before `transceiver` goes out of scope.
EXPECT_CALL(channel1, SetFirstPacketReceivedCallback(_));
EXPECT_CALL(cm, DestroyChannel(&channel1)).WillRepeatedly(testing::Return());
transceiver->SetChannel(nullptr, nullptr);
transceiver->ClearChannel();
}
// Checks that a channel can be unset on a stopped `RtpTransceiver`
@ -112,7 +112,7 @@ TEST(RtpTransceiverTest, CanUnsetChannelOnStoppedTransceiver) {
EXPECT_EQ(&channel, transceiver->channel());
// Set the channel to `nullptr`.
transceiver->SetChannel(nullptr, nullptr);
transceiver->ClearChannel();
EXPECT_EQ(nullptr, transceiver->channel());
}
@ -217,7 +217,7 @@ class RtpTransceiverTestForHeaderExtensions : public ::testing::Test {
EXPECT_CALL(mock_channel, SetFirstPacketReceivedCallback(_));
EXPECT_CALL(channel_manager_, DestroyChannel(&mock_channel))
.WillRepeatedly(testing::Return());
transceiver_->SetChannel(nullptr, nullptr);
transceiver_->ClearChannel();
}
rtc::scoped_refptr<MockRtpReceiverInternal> receiver_ = MockReceiver();