OWT Server之webrtc_agent源码分析_接收流

一,对象创建流程

connection.js 封装并调用了rtcConn.node;

wrtcConnection.js 封装并调用了rtcFrame.node;

oem@svr1804:~/git/owt-server/dist-debug$ ll -h  webrtc_agent/rtcFrame/build/Release/rtcFrame.node 
-rwxrwxr-x 1 oem oem 7.7M 5月  14 22:57 webrtc_agent/rtcFrame/build/Release/rtcFrame.node*
oem@svr1804:~/git/owt-server/dist-debug$ ll -h  webrtc_agent/rtcConn/build/Release/rtcConn.node 
-rwxrwxr-x 1 oem oem 25M 5月  14 22:57 webrtc_agent/rtcConn/build/Release/rtcConn.node*

/home/oem/git/owt-server/dist-debug/webrtc_agent/webrtc/index.js
var addon = require('../rtcConn/build/Release/rtcConn.node');
(只调用了addon.ThreadPool)

/home/oem/git/owt-server/dist-debug/webrtc_agent/webrtc/connection.js
const addon = require('../rtcConn/build/Release/rtcConn');

  _createWrtc() {
    var wrtc = new addon.WebRtcConnection(
      this.threadPool, this.ioThreadPool, this.id,
      global.config.webrtc.stunserver,
      global.config.webrtc.stunport,
      global.config.webrtc.minport,
      global.config.webrtc.maxport,
      false, //this.trickleIce,
      this._getMediaConfiguration(this.mediaConfiguration),

      '', //networkinterface
      this.ipAddresses
    );

  _createMediaStream(id, options = {}, isPublisher = true) {
    log.debug(`message: _createMediaStream, connectionId: ${this.id}, ` +
              `mediaStreamId: ${id}, isPublisher: ${isPublisher}`);
    const mediaStream = new addon.MediaStream(this.threadPool, this.wrtc, id,
      options.label, this._getMediaConfiguration(this.mediaConfiguration), isPublisher);

/home/oem/git/owt-server/dist-debug/webrtc_agent/webrtc/wrtcConnection.js
const {
  AudioFrameConstructor,
  AudioFramePacketizer,
  VideoFrameConstructor,
  VideoFramePacketizer,
  CallBase,
} = require('../rtcFrame/build/Release/rtcFrame.node');

收到that.publish()调用,创建WebRTC对象

CALL STACK(从下往上调用): 

Connection (/home/oem/git/owt-server/dist-debug/webrtc_agent/webrtc/connection.js:69)
class Connection extends EventEmitter {
  constructor (id, threadPool, ioThreadPool, options = {}) {
    super();
    log.info(`message: Connection, id: ${id}`);
    this.wrtc = this._createWrtc();
  }
_createWrtc() {
    var wrtc = new addon.WebRtcConnection(

module.exports (/home/oem/git/owt-server/dist-debug/webrtc_agent/webrtc/wrtcConnection.js:635)
  wrtc = new Connection(wrtcId, threadPool, ioThreadPool, { ipAddresses });
  wrtc.callBase = new CallBase();
  // wrtc.addMediaStream(wrtcId, {label: ''}, direction === 'in');

  initWebRtcConnection(wrtc);

createWebRTCConnection (/home/oem/git/owt-server/dist-debug/webrtc_agent/webrtc/index.js:137)
    var createWebRTCConnection = function (transportId, controller, owner) {
        var connection = new WrtcConnection({
            connectionId: transportId,
            threadPool: threadPoo
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值