当前位置: 首页 > news >正文

江门网站自助建站湖南网站排名

江门网站自助建站,湖南网站排名,wordpress自定义文章页面模板,制作app页面的软件概述 RTC::Transport是mediasoup中的一个重要概念,它用于在mediasoup与客户端之间传输实时音视频数据。 Transport继承着众多的类,主要用于Transport的整体感知 class Transport : public RTC::Producer::Listener,public RTC::Consumer::Listener,publ…
概述

RTC::Transport是mediasoup中的一个重要概念,它用于在mediasoup与客户端之间传输实时音视频数据。

Transport继承着众多的类,主要用于Transport的整体感知

	class Transport : public RTC::Producer::Listener,public RTC::Consumer::Listener,public RTC::DataProducer::Listener,public RTC::DataConsumer::Listener,public RTC::SctpAssociation::Listener,public RTC::TransportCongestionControlClient::Listener,public RTC::TransportCongestionControlServer::Listener,public Channel::ChannelSocket::RequestHandler,public PayloadChannel::PayloadChannelSocket::RequestHandler,public PayloadChannel::PayloadChannelSocket::NotificationHandler,
分析Transport的创建流程

在Router层会根据类型来进入分支创建transport,以PlainTransport为例

			case Channel::ChannelRequest::MethodId::ROUTER_CREATE_PLAIN_TRANSPORT:{std::string transportId;//从上层获取到transport的ID// This may throwSetNewTransportIdFromData(request->data, transportId);auto* plainTransport =new RTC::PlainTransport(this->shared, transportId, this, request->data);// Insert into the map.绑定ID与transport的映射this->mapTransports[transportId] = plainTransport;MS_DEBUG_DEV("PlainTransport created [transportId:%s]", transportId.c_str());json data = json::object();plainTransport->FillJson(data);request->Accept(data);break;}

在构造函数中,创建了socket,并且绑定了通道消息回调

	PlainTransport::PlainTransport(RTC::Shared* shared, const std::string& id, RTC::Transport::Listener* listener, json& data): RTC::Transport::Transport(shared, id, listener, data){MS_TRACE();auto jsonListenIpIt = data.find("listenIp");if (jsonListenIpIt == data.end())MS_THROW_TYPE_ERROR("missing listenIp");else if (!jsonListenIpIt->is_object())MS_THROW_TYPE_ERROR("wrong listenIp (not an object)");auto jsonIpIt = jsonListenIpIt->find("ip");if (jsonIpIt == jsonListenIpIt->end())MS_THROW_TYPE_ERROR("missing listenIp.ip");else if (!jsonIpIt->is_string())MS_THROW_TYPE_ERROR("wrong listenIp.ip (not an string)");//获得内网IPthis->listenIp.ip.assign(jsonIpIt->get<std::string>());// This may throw.Utils::IP::NormalizeIp(this->listenIp.ip);auto jsonAnnouncedIpIt = jsonListenIpIt->find("announcedIp");if (jsonAnnouncedIpIt != jsonListenIpIt->end()){if (!jsonAnnouncedIpIt->is_string())MS_THROW_TYPE_ERROR("wrong listenIp.announcedIp (not an string");//获得外网IPthis->listenIp.announcedIp.assign(jsonAnnouncedIpIt->get<std::string>());}//获取端口uint16_t port{ 0 };auto jsonPortIt = data.find("port");//判断端口是否合法if (jsonPortIt != data.end()){if (!(jsonPortIt->is_number() && Utils::Json::IsPositiveInteger(*jsonPortIt)))MS_THROW_TYPE_ERROR("wrong port (not a positive number)");port = jsonPortIt->get<uint16_t>();}auto jsonRtcpMuxIt = data.find("rtcpMux");if (jsonRtcpMuxIt != data.end()){if (!jsonRtcpMuxIt->is_boolean())MS_THROW_TYPE_ERROR("wrong rtcpMux (not a boolean)");this->rtcpMux = jsonRtcpMuxIt->get<bool>();}auto jsonComediaIt = data.find("comedia");if (jsonComediaIt != data.end()){if (!jsonComediaIt->is_boolean())MS_THROW_TYPE_ERROR("wrong comedia (not a boolean)");this->comedia = jsonComediaIt->get<bool>();}auto jsonEnableSrtpIt = data.find("enableSrtp");// clang-format offif (jsonEnableSrtpIt != data.end() &&jsonEnableSrtpIt->is_boolean() &&jsonEnableSrtpIt->get<bool>())// clang-format on{auto jsonSrtpCryptoSuiteIt = data.find("srtpCryptoSuite");if (jsonSrtpCryptoSuiteIt == data.end() || !jsonSrtpCryptoSuiteIt->is_string())MS_THROW_TYPE_ERROR("missing srtpCryptoSuite)");// Ensure it's a crypto suite supported by us.auto it =PlainTransport::string2SrtpCryptoSuite.find(jsonSrtpCryptoSuiteIt->get<std::string>());if (it == PlainTransport::string2SrtpCryptoSuite.end())MS_THROW_TYPE_ERROR("invalid/unsupported srtpCryptoSuite");// NOTE: The SRTP crypto suite may change later on connect().this->srtpCryptoSuite = it->second;switch (this->srtpCryptoSuite){case RTC::SrtpSession::CryptoSuite::AEAD_AES_256_GCM:{this->srtpMasterLength = SrtpAesGcm256MasterLength;break;}case RTC::SrtpSession::CryptoSuite::AEAD_AES_128_GCM:{this->srtpMasterLength = SrtpAesGcm128MasterLength;break;}case RTC::SrtpSession::CryptoSuite::AES_CM_128_HMAC_SHA1_80:case RTC::SrtpSession::CryptoSuite::AES_CM_128_HMAC_SHA1_32:{this->srtpMasterLength = SrtpMasterLength;break;}default:{MS_ABORT("unknown SRTP crypto suite");}}this->srtpKey       = Utils::Crypto::GetRandomString(this->srtpMasterLength);this->srtpKeyBase64 = Utils::String::Base64Encode(this->srtpKey);//进行base64编码}try{// This may throw. 通过 listenIp, port 创建 UdpSocketif (port != 0)this->udpSocket = new RTC::UdpSocket(this, this->listenIp.ip, port);elsethis->udpSocket = new RTC::UdpSocket(this, this->listenIp.ip);if (!this->rtcpMux){// This may throw.this->rtcpUdpSocket = new RTC::UdpSocket(this, this->listenIp.ip);}// NOTE: This may throw.this->shared->channelMessageRegistrator->RegisterHandler(this->id,/*channelRequestHandler*/ this,/*payloadChannelRequestHandler*/ this,/*payloadChannelNotificationHandler*/ this);}catch (const MediaSoupError& error){delete this->udpSocket;this->udpSocket = nullptr;delete this->rtcpUdpSocket;this->rtcpUdpSocket = nullptr;throw;}}

http://www.tj-hxxt.cn/news/30948.html

相关文章:

  • 网站建设与网页设计入门百度定位店铺位置怎么设置
  • 阳泉市住房保障和城乡建设管理局网站夫唯seo视频教程
  • 企业网站建设制作建站模板
  • xml网站地图在线生成工具搜索引擎入口yandex
  • 网站制作网站建设单位企业网络营销案例
  • 东莞 网站制作西安网站建设优化
  • 惠东做网站公司淘宝关键词推广
  • 肥城市区seo关键词排名扬州整站seo
  • 如何建设网站兴田德润简介呢seo平台
  • 微淘客网站建设seo人员工作内容
  • 网站开发Z亿玛酷1订制优化软件刷排名seo
  • wordpress网站阿里云备案武汉seo优化分析
  • 东莞百度seo推广机构seo搜索引擎优化岗位要求
  • 个人备案网站服务内容seo 是什么
  • 把网站制作成app宁波seo外包推广渠道
  • 做短视频网站有流量吗广告电话
  • 济南网站建设公司公司推广策划方案
  • 网站开发从何学起seo公司赚钱吗
  • 打开网站占空间郑州网络营销推广机构
  • 阿里云t5做网站全国互联网营销大赛官网
  • 万网搭建淘宝客网站代推广平台
  • 台州网站建设百度怎么搜索网址打开网页
  • 广告装饰 技术支持 东莞网站建设百度 营销推广是做什么的
  • wordpress+子主题+教程seo外链工具有用吗
  • 深圳歌剧院设计方案站外seo是什么
  • react 做网站电商平台
  • 企业网站建设排名客服seo网站推广教程
  • 做电商网站的步骤站长工具seo排名
  • 济南 论坛网站建设自己建网站详细流程
  • 网站产品介绍长图哪个软件做的推广seo优化公司