Add a check for empty channels to ChannelManager dtor.

This is a necessary precondition for upcoming changes that will remove
calls to Invoke() that currently occur during construction/destruction
of media channel objects.

Subsequently fix RtpSenderReceiverTest to destroy channels that were
created in the constructor, in the destructor.

Bug: webrtc:11992
Change-Id: I526908d997d27495659805d84113c84c48568712
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/246680
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35702}
This commit is contained in:
Tomas Gunnarsson 2022-01-15 14:04:27 +01:00 committed by WebRTC LUCI CQ
parent 40941ee72d
commit 2e85b5fa51
2 changed files with 6 additions and 0 deletions

View File

@ -58,6 +58,8 @@ ChannelManager::ChannelManager(
ChannelManager::~ChannelManager() {
RTC_DCHECK_RUN_ON(worker_thread_);
RTC_DCHECK(voice_channels_.empty());
RTC_DCHECK(video_channels_.empty());
}
void ChannelManager::GetSupportedAudioSendCodecs(

View File

@ -169,6 +169,10 @@ class RtpSenderReceiverTest
local_stream_ = nullptr;
video_track_ = nullptr;
audio_track_ = nullptr;
channel_manager_->DestroyVoiceChannel(voice_channel_);
channel_manager_->DestroyVideoChannel(video_channel_);
worker_thread_->Invoke<void>(RTC_FROM_HERE,
[&]() { channel_manager_.reset(); });
}