Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: webrtc/voice_engine/channel_manager.cc

Issue 2755273004: Add thread check to ModuleProcessThread::DeRegisterModule (Closed)
Patch Set: Remove TODO Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webrtc/voice_engine/channel.cc ('K') | « webrtc/voice_engine/channel.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/voice_engine/channel_manager.cc
diff --git a/webrtc/voice_engine/channel_manager.cc b/webrtc/voice_engine/channel_manager.cc
index b81c8a63cc98a185ea5f40667e35f786590b28b3..58aef6f7ee7c08773c805f0a8b1a30a35cbdac29 100644
--- a/webrtc/voice_engine/channel_manager.cc
+++ b/webrtc/voice_engine/channel_manager.cc
@@ -106,6 +106,12 @@ void ChannelManager::DestroyChannel(int32_t channel_id) {
channels_.erase(to_delete);
}
}
+ if (reference.channel()) {
+ // Ensure the channel is torn down now, on this thread, since a reference
+ // may still be held on a different thread (e.g. in the audio capture
+ // thread).
+ reference.channel()->Terminate();
+ }
}
void ChannelManager::DestroyAllChannels() {
@@ -117,6 +123,10 @@ void ChannelManager::DestroyAllChannels() {
references = channels_;
channels_.clear();
}
+ for (auto& owner : references) {
+ if (owner.channel())
+ owner.channel()->Terminate();
+ }
}
size_t ChannelManager::NumOfChannels() const {
« webrtc/voice_engine/channel.cc ('K') | « webrtc/voice_engine/channel.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698