diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc index 9739c8924d..364d1963b0 100644 --- a/talk/app/webrtc/java/jni/peerconnection_jni.cc +++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc @@ -1928,6 +1928,12 @@ class OwnedFactoryAndThreads { JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnectionFactory)( JNIEnv* jni, jclass) { + // talk/ assumes pretty widely that the current Thread is ThreadManager'd, but + // ThreadManager only WrapCurrentThread()s the thread where it is first + // created. Since the semantics around when auto-wrapping happens in + // talk/base/ are convoluted, we simply wrap here to avoid having to think + // about ramifications of auto-wrapping there. + talk_base::ThreadManager::Instance()->WrapCurrentThread(); webrtc::Trace::CreateTrace(); Thread* worker_thread = new Thread(); worker_thread->SetName("worker_thread", NULL);