专业版式设计网站,哪里查询网站备案,如何识别网站建设,哈尔滨门户网站制作哪家好WebRTC中的三个主要线程#xff1a;
signaling_thread#xff0c;信号线程#xff1a;用于与应用层交互worker_thread#xff0c;工作线程#xff08;最核心#xff09;#xff1a;负责内部逻辑处理network_thread#xff0c;网络线程#xff1a;负责网络数据包的收发…WebRTC中的三个主要线程
signaling_thread信号线程用于与应用层交互worker_thread工作线程最核心负责内部逻辑处理network_thread网络线程负责网络数据包的收发
webrtc中的其他线程都是通过这三个线程创建出来的
webrtc中创建三个线程的位置
// src/examples/peerconnection/client/conductor.cc
bool Conductor::InitializePeerConnection() {peer_connection_factory_ webrtc::CreatePeerConnectionFactory();
}// src/pc/peer_connection_factory.cc
PeerConnectionFactory::PeerConnectionFactory(PeerConnectionFactoryDependencies dependencies)
{if (!network_thread_) {owned_network_thread_ rtc::Thread::CreateWithSocketServer(); // CreateWithSocketServer() 用于处理网络事件owned_network_thread_-SetName(pc_network_thread, nullptr);owned_network_thread_-Start();network_thread_ owned_network_thread_.get();}if (!worker_thread_) {owned_worker_thread_ rtc::Thread::Create(); // Create() 不处理网络事件owned_worker_thread_-SetName(pc_worker_thread, nullptr);owned_worker_thread_-Start();worker_thread_ owned_worker_thread_.get();}if (!signaling_thread_) {signaling_thread_ rtc::Thread::Current(); // Current() 默认将主线程当做signal线程if (!signaling_thread_) {signaling_thread_ rtc::ThreadManager::Instance()-WrapCurrentThread();wraps_current_thread_ true;}}
}PS编码技巧当传入的参数较多时可以打包成一个结构体传下去如dependencies其中指定 dependencies.network_thread, dependencies.signaling_thread, dependencies.worker_thread 等 以及火山引擎SDK中的video_frame等都是如此