https://github.com/versatica/mediasoup.git 核心库:C++和node.js。
https://github.com/versatica/mediasoup-demo.git demo:有serevr、app即client,用的js。
特性:Simulcast and SVC support.
Congestion control.
Sender and receiver bandwidth estimation with spatial/temporal layers distribution algorithm.
C++和Node.js通过发送json字符串通信。
node.js通过配置文件config.js,创建几个worker,一般是cpu核数。
C++:通过mediasoup_worker_run(),作为一个独立程序运行起来。
Worker包括router,即房间。
Router包括Producer、Consumer(有SimpleConsumer、PipeConsumer、SvcConsumer、SimulcastConsumer等)、Transport(有WebRtcTransport、PipeTransport等)等。
创建Router、Producer、Consumer、Transport等都是通过发送字符串,Node.js和C++通信。
消息的格式用的开源库protoo-server、protoo-client。
网络库用了libuv,通过pipe进行通信。
uv_pipe_init、uv_pipe_open、uv_read_start、uv_read_stop、uv_write等。
pipe通信,不需要端口,传入fd。
因为是单向发送,单向接收,所以不需要加锁。
new Channel::ChannelSocket(consumerChannelFd, producerChannelFd)。
static constexpr int ConsumerChannelFd{ 3 };
static constexpr int ProducerChannelFd{ 4 };
消息有两种:1种是事件响应,有id,另一种是事件通知。
因为是C++和Node.js混合开发,这样的设计(两个独立的程序)造成它们需要通信啊。
好处呢?高并发?
代码目录结构挺清晰。
和janus对比?