webrtc peerconnection_client peerconnection_server 连接失败问题解决 win10 win11

0 常见问题

(1) webrtc peerconnection_client 连接 peerconnection_server 无连接列表

(2)连接导致崩溃debug状态下因为这个断言 RTC_DCHECK_RUN_ON(&capture_checker_);

1 在 peerconnection\client\main.cc 当中

定义类

class CustomSocketServer : public rtc::PhysicalSocketServer {

public:

bool Wait(webrtc::TimeDelta max_wait_duration, bool process_io) override {

if (!process_io)

return true;

return rtc::PhysicalSocketServer::Wait(webrtc::TimeDelta::Zero(),

+process_io);

}

};

2 在 peerconnection\client\main.cc 当中替换rtc::PhysicalSocketServer ss; 为 CustomSocketServer ss;

//rtc::PhysicalSocketServer ss;

CustomSocketServer ss;

3 在 peerconnection\client\main.cc 当中 // Main loop.之前添加一句话

main_thread.Start();//添加这句话

// Main loop.

MSG msg;

BOOL gm;

while ((gm = ::GetMessage(&msg, NULL, 0, 0)) != 0 && gm != -1) {

if (!wnd.PreTranslateMessage(&msg)) {

::TranslateMessage(&msg);

::DispatchMessage(&msg);

}

}

4 在 \src\modules\video_capture\windows\sink_filter_ds.cc

STDMETHODIMP CaptureInputPin::Receive(IMediaSample* media_sample) {

//RTC_DCHECK_RUN_ON(&capture_checker_);

Debug版本这一行会崩溃,主要是webrtc的线程机制会判断capture_checker_是否处于同一线程,不是则会触发断言,暂时的处理方式可通过屏蔽这行解决崩溃问题。

注意

1 localhost 换成 127.0.0.1

2 本机回环要有obs虚拟摄像头 最好两台电脑跑

相关推荐
好家伙VCC2 天前
### WebRTC技术:实时通信的革新与实现####webRTC(Web Real-TimeComm
java·前端·python·webrtc
XHW___0013 天前
webrtc 关键模块创建的时机
网络·音视频·webrtc
我真会写代码3 天前
WebSocket:告别轮询,实现Web实时通信 WebRTC:无需插件,实现浏览器端实时音视频通信
网络·websocket·网络协议·webrtc·实时音视频
又是忙碌的一天3 天前
SpringBoot+Vue+Netty+WebSocket+WebRTC 视频聊天实现
websocket·音视频·webrtc
柒.梧.4 天前
理解WebRTC:浏览器原生实时音视频通信
webrtc·实时音视频
XHW___0014 天前
webrtc中音频3A处理开关配置
音视频·webrtc
sin22014 天前
WebRTC--流程
spring boot·webrtc
runner365.git5 天前
webrtc服务端如何录像
webrtc·录像·fmp4·mpegts
大佐不会说日语~7 天前
WebRTC技术实现简易直播平台
webrtc
YRYDZFtyVKg9 天前
光伏MPPT仿真之扰动观察法探索
webrtc