Licode Simulcast

转载自:https://www.jianshu.com/p/aabda9369224

Publisher端创建stream的时候config参数添加simulcast

room.publish(localStream, {simulcast: {numSpatialLayers: 2}});

numSpatialLayers 是Publisher发送的spatial layers的最大数

目前web端的话只能是遵循原生webrtc的设定

struct SimulcastFormat {
  int width;
  int height;
  // The maximum number of simulcast layers can be used for
  // resolutions at |widthxheigh|.
  size_t max_layers;
  // The maximum bitrate for encoding stream at |widthxheight|, when we are
  // not sending the next higher spatial stream.
  int max_bitrate_kbps;
  // The target bitrate for encoding stream at |widthxheight|, when this layer
  // is not the highest layer (i.e., when we are sending another higher spatial
  // stream).
  int target_bitrate_kbps;
  // The minimum bitrate needed for encoding stream at |widthxheight|.
  int min_bitrate_kbps;
};

// These tables describe from which resolution we can use how many
// simulcast layers at what bitrates (maximum, target, and minimum).
// Important!! Keep this table from high resolution to low resolution.
// clang-format off
const SimulcastFormat kSimulcastFormats[] = {
  {1920, 1080, 3, 5000, 4000, 800},
  {1280, 720, 3,  2500, 2500, 600},
  {960, 540, 3, 900, 900, 450},
  {640, 360, 2, 700, 500, 150},
  {480, 270, 2, 450, 350, 150},
  {320, 180, 1, 200, 150, 30},
  {0, 0, 1, 200, 150, 30}
};

Subscriber 订阅流的时候可以直接按照普通subscriber订阅的方式直接订阅,比较nice的一点是,可以指定订阅spatialLayer和temporalLayer,其中spatiaLayer为resolutions,temporalLayer为FrameRate,一般temporalLayer有三个可供选择,比如:

Spatial Layer (0): 320 240
Spatial Layer (1): 640 480
Spatial Layer (2): 0 0
Spatial Layer (3): 0 0
Temporal Layer (0): 3
Temporal Layer (1): 11
Temporal Layer (2): 14
Temporal Layer (3): 0
Temporal Layer (4): 0

可以在room.on(‘stream-subscribed’, function (streamEvent) 事件中设定

stream._setStaticQualityLayer(1, 2);

这样订阅的就是分辨率640 x 480帧率为14的流

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值