Declare BaseChannel::media_channel_ const
This makes it thread-safe to access, but not necessarily to use. Bug: webrtc:12230 Change-Id: I6b48d86dff24b162d382135abeaf560971fdf614 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196524 Reviewed-by: Henrik Boström <hbos@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32785}
This commit is contained in:
parent
ea969d287b
commit
0f0bcb39f3
@ -152,17 +152,12 @@ BaseChannel::~BaseChannel() {
|
||||
// Eats any outstanding messages or packets.
|
||||
worker_thread_->Clear(&invoker_);
|
||||
worker_thread_->Clear(this);
|
||||
// We must destroy the media channel before the transport channel, otherwise
|
||||
// the media channel may try to send on the dead transport channel. NULLing
|
||||
// is not an effective strategy since the sends will come on another thread.
|
||||
media_channel_.reset();
|
||||
RTC_LOG(LS_INFO) << "Destroyed channel: " << ToString();
|
||||
// The media channel is destroyed at the end of the destructor, since it
|
||||
// is a std::unique_ptr. The transport channel (rtp_transport) must outlive
|
||||
// the media channel.
|
||||
}
|
||||
|
||||
std::string BaseChannel::ToString() const {
|
||||
// TODO(bugs.webrtc.org/12230): When media_channel_ is guarded by
|
||||
// worker_thread(), rewrite this debug printout to not print the
|
||||
// media type when called from non-worker-thread.
|
||||
rtc::StringBuilder sb;
|
||||
sb << "{mid: " << content_name_;
|
||||
if (media_channel_) {
|
||||
|
||||
@ -185,9 +185,6 @@ class BaseChannel : public ChannelInterface,
|
||||
}
|
||||
|
||||
MediaChannel* media_channel() const override {
|
||||
// TODO(bugs.webrtc.org/12230): Called on multiple threads,
|
||||
// including from StatsCollector::ExtractMediaInfo.
|
||||
// RTC_DCHECK_RUN_ON(worker_thread());
|
||||
return media_channel_.get();
|
||||
}
|
||||
|
||||
@ -348,9 +345,7 @@ class BaseChannel : public ChannelInterface,
|
||||
|
||||
// MediaChannel related members that should be accessed from the worker
|
||||
// thread.
|
||||
// TODO(bugs.webrtc.org/12230): written on worker thread, accessed by
|
||||
// multiple threads.
|
||||
std::unique_ptr<MediaChannel> media_channel_;
|
||||
const std::unique_ptr<MediaChannel> media_channel_;
|
||||
// Currently the |enabled_| flag is accessed from the signaling thread as
|
||||
// well, but it can be changed only when signaling thread does a synchronous
|
||||
// call to the worker thread, so it should be safe.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user