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虚拟摄像头 最好两台电脑跑

相关推荐
softshow10261 天前
Vue3 :封装 WebRTC 低延迟视频流与 WebSocket 实时状态驱动的大屏可视化
websocket·网络协议·webrtc
雨落秋垣3 天前
大屏可视化系统:WebRTC视频流与WebSocket实时数据集成方案
websocket·网络协议·webrtc
此颜差矣。4 天前
封装 WebRTC 低延迟视频流与 WebSocket 实时状态驱动的大屏可视化
websocket·webrtc·低延迟视频流
metaRTC4 天前
metaRTC 8.0 重磅发布:专为新一代 AI 终端而生的实时通信引擎
ai·webrtc
三十_A7 天前
WebRTC 入门:一分钟理解会议系统的三种架构(Mesh/SFU/MCU)
架构·webrtc
qq_310658518 天前
webrtc源码走读(五)核心引擎层——传输模块
服务器·网络·音视频·webrtc
三十_8 天前
WebRTC 入门:一分钟理解会议系统的三种架构(Mesh/SFU/MCU)
前端·后端·webrtc
qq_310658518 天前
webrtc源码走读(六)核心引擎层——安全模块
服务器·c++·音视频·webrtc
REDcker8 天前
WebRTC-HTTP 出口协议 (WHEP) draft-murillo-whep-01 中文翻译
网络协议·http·webrtc