博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
webrtc Codec生成相关
阅读量:6884 次
发布时间:2019-06-27

本文共 2977 字,大约阅读时间需要 9 分钟。

1. sdp video codec生成

InternalEncoderFactory::InternalEncoderFactory() {  supported_codecs_.push_back(cricket::VideoCodec(kVp8CodecName));  if (webrtc::VP9Encoder::IsSupported())    supported_codecs_.push_back(cricket::VideoCodec(kVp9CodecName));  if (webrtc::H264Encoder::IsSupported()) {    cricket::VideoCodec codec(kH264CodecName);    // TODO(magjed): Move setting these parameters into webrtc::H264Encoder    // instead.    codec.SetParam(kH264FmtpProfileLevelId,                   kH264ProfileLevelConstrainedBaseline);    codec.SetParam(kH264FmtpLevelAsymmetryAllowed, "1");    supported_codecs_.push_back(std::move(codec));  }  supported_codecs_.push_back(cricket::VideoCodec(kRedCodecName));  supported_codecs_.push_back(cricket::VideoCodec(kUlpfecCodecName));  if (IsFlexfecAdvertisedFieldTrialEnabled()) {    cricket::VideoCodec flexfec_codec(kFlexfecCodecName);    // This value is currently arbitrarily set to 10 seconds. (The unit    // is microseconds.) This parameter MUST be present in the SDP, but    // we never use the actual value anywhere in our code however.    // TODO(brandtr): Consider honouring this value in the sender and receiver.    flexfec_codec.SetParam(kFlexfecFmtpRepairWindow, "10000000");    flexfec_codec.AddFeedbackParam(        FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty));    flexfec_codec.AddFeedbackParam(        FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty));    supported_codecs_.push_back(flexfec_codec);  }}

以上是生成sdp中支持的codec,除此之外还会生成rtx codec,创建的函数为CreateRtxCode,代码如下:

static void AppendVideoCodecs(const std::vector
& input_codecs, std::vector
* unified_codecs) { for (VideoCodec codec : input_codecs) { const rtc::Optional
payload_type = NextFreePayloadType(*unified_codecs, codec.name); if (!payload_type) return; codec.id = *payload_type; // TODO(magjed): Move the responsibility of setting these parameters to the // encoder factories instead. if (codec.name != kRedCodecName && codec.name != kUlpfecCodecName && codec.name != kFlexfecCodecName) AddDefaultFeedbackParams(&codec); // Don't add same codec twice. if (FindMatchingCodec(*unified_codecs, codec)) continue; unified_codecs->push_back(codec); // Add associated RTX codec for recognized codecs. // TODO(deadbeef): Should we add RTX codecs for external codecs whose names // we don't recognize? if (CodecNamesEq(codec.name, kVp8CodecName) || CodecNamesEq(codec.name, kVp9CodecName) || CodecNamesEq(codec.name, kH264CodecName) || CodecNamesEq(codec.name, kRedCodecName)) { const rtc::Optional
rtx_payload_type = NextFreePayloadType(*unified_codecs); if (!rtx_payload_type) return; unified_codecs->push_back( VideoCodec::CreateRtxCodec(*rtx_payload_type, codec.id)); } }}

转载于:https://my.oschina.net/xgcode/blog/2209130

你可能感兴趣的文章
体绘制(Volume Rendering)概述之4:光线投射算法(Ray Casting)实现流程和代码(基于CPU的实现)...
查看>>
Python实践之(七)逻辑回归(Logistic Regression)
查看>>
PAT (Advanced Level) 1107. Social Clusters (30)
查看>>
【开源社群系统研发日记五】ThinkSNS+ 是如何计算字符显示长度的
查看>>
Nodejs日志管理log4js
查看>>
python获取昨日日期
查看>>
海康威视 - 萤石云开放平台 js 版
查看>>
关于分销平台
查看>>
剑指offer---12-**--数值的整数次方
查看>>
PAT - L2-010. 排座位(并查集)
查看>>
Python 学习笔记 - 线程(线程锁,信标,事件和条件)
查看>>
大数据技术服务商个推获4亿人民币D轮融资
查看>>
Git的详细使用教程
查看>>
[LeetCode]40.Combination Sum II
查看>>
python里的拆包、引用、递归与匿名函数
查看>>
关于前端项目代码检测~
查看>>
初探 BaconJS
查看>>
使用CDN(Content Delivery Network)加速站点访问速度汇总指北
查看>>
区块链生态圈应用落地须了解区块链共识技术开发
查看>>
ES6学习文档(更新至第7节)
查看>>