如何释放对等连接线程?

时间:2018-08-14 05:38:24

标签: java-native-interface webrtc native

我按如下方式创建对等连接工厂,当我删除包装对象时,然后...

../../ webrtc / base / physicalsocketserver.cc中的致命错误,行1188,

上次系统错误:316

检查失败:dispatchers_.empty()

worker_thread = rtc::Thread::Create();
worker_thread->SetName("worker_thread", nullptr);
RTC_CHECK(worker_thread->Start()) << "Failed to start thread";
signaling_thread = rtc::Thread::Create();
signaling_thread->SetName("signaling_thread", nullptr);
RTC_CHECK(signaling_thread->Start()) << "Failed to start thread";
network_thread = rtc::Thread::CreateWithSocketServer();
network_thread->SetName("network_thread", nullptr);
RTC_CHECK(network_thread->Start()) << "Failed to start thread";
auto audioDeviceModule = worker_thread->Invoke<rtc::scoped_refptr<webrtc::AudioDeviceModule>>(
        RTC_FROM_HERE,
        [=]() {
            auto audio_device =
                    new AudioDeviceModuleWrapper(webrtc::AudioDeviceModule::AudioLayer::kPlatformDefaultAudio);
            audio_device->Init();
            int16_t num = audio_device->RecordingDevices();
            for (int16_t i = 0; i < num; i++) {
                char name[webrtc::kAdmMaxDeviceNameSize];
                char guid[webrtc::kAdmMaxGuidSize];
                int ret = audio_device->RecordingDeviceName(static_cast<uint16_t>(i), name, guid);
                std::string name_str(name);
                if (!audio_card_id.empty() && name_str.find(audio_card_id) == 0) {
                    is_connect_to_audio_card = true;
                    audio_device->SetDeviceId(static_cast<uint16_t>(i));
                }
            }
            return audio_device;
        });
peer_connection_factory = webrtc::CreatePeerConnectionFactory(network_thread.get(), worker_thread.get(), signaling_thread.get(),
                                                              audioDeviceModule, nullptr, nullptr);

0 个答案:

没有答案