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 { |