「Mutilated Webrtc」Fec Encode

2024-04-01 17:32
文章标签 encode webrtc fec mutilated

本文主要是介绍「Mutilated Webrtc」Fec Encode,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

从这里计算丢包率

void RtpTransportControllerSend::OnReceivedRtcpReceiverReportBlocks(const ReportBlockList& report_blocks,int64_t now_ms) {if (report_blocks.empty())return;int total_packets_lost_delta = 0;int total_packets_delta = 0;// Compute the packet loss from all report blocks.for (const RTCPReportBlock& report_block : report_blocks) {auto it = last_report_blocks_.find(report_block.source_ssrc);if (it != last_report_blocks_.end()) {auto number_of_packets = report_block.extended_highest_sequence_number -it->second.extended_highest_sequence_number;total_packets_delta += number_of_packets;auto lost_delta = report_block.packets_lost - it->second.packets_lost;total_packets_lost_delta += lost_delta;}last_report_blocks_[report_block.source_ssrc] = report_block;}// Can only compute delta if there has been previous blocks to compare to. If// not, total_packets_delta will be unchanged and there's nothing more to do.if (!total_packets_delta)return;int packets_received_delta = total_packets_delta - total_packets_lost_delta;// To detect lost packets, at least one packet has to be received. This check// is needed to avoid bandwith detection update in// VideoSendStreamTest.SuspendBelowMinBitrateif (packets_received_delta < 1)return;Timestamp now = Timestamp::Millis(now_ms);TransportLossReport msg;msg.packets_lost_delta = total_packets_lost_delta;msg.packets_received_delta = packets_received_delta;msg.receive_time = now;msg.start_time = last_report_block_time_;msg.end_time = now;if (controller_) {RTC_LOG(LS_ERROR) << "kiki-fec: RtpTransportControllerSend::OnReceivedRtcpReceiverReportBlocks";PostUpdates(controller_->OnTransportLossReport(msg));}last_report_block_time_ = now;
}

123

void RtpTransportControllerSend::PostUpdates(NetworkControlUpdate update) {if (update.congestion_window) {pacer()->SetCongestionWindow(*update.congestion_window);}if (update.pacer_config) {pacer()->SetPacingRates(update.pacer_config->data_rate(),update.pacer_config->pad_rate());}for (const auto& probe : update.probe_cluster_configs) {pacer()->CreateProbeCluster(probe.target_data_rate, probe.id);}if (update.target_rate) {control_handler_->SetTargetRate(*update.target_rate);UpdateControlState();}
}

在这里被设置

void CongestionControlHandler::SetTargetRate(TargetTransferRate new_target_rate) {RTC_DCHECK_RUN_ON(&sequenced_checker_);RTC_CHECK(new_target_rate.at_time.IsFinite());last_incoming_ = new_target_rate;
}

这里定期获得最后的记录,传递下去。值得注意的是,这里有个标志位disable_pacer_emergency_stop_是0。

void RtpTransportControllerSend::UpdateControlState() {absl::optional<TargetTransferRate> update = control_handler_->GetUpdate();if (!update)return;retransmission_rate_limiter_.SetMaxRate(update->target_rate.bps());// We won't create control_handler_ until we have an observers.RTC_DCHECK(observer_ != nullptr);observer_->OnTargetTransferRate(*update);
}
absl::optional<TargetTransferRate> CongestionControlHandler::GetUpdate() {RTC_DCHECK_RUN_ON(&sequenced_checker_);if (!last_incoming_.has_value())return absl::nullopt;TargetTransferRate new_outgoing = *last_incoming_;DataRate log_target_rate = new_outgoing.target_rate;bool pause_encoding = false;if (!network_available_) {pause_encoding = true;} else if (!disable_pacer_emergency_stop_ &&pacer_expected_queue_ms_ > PacedSender::kMaxQueueLengthMs) {pause_encoding = true;}if (pause_encoding)new_outgoing.target_rate = DataRate::Zero();if (!last_reported_ ||last_reported_->target_rate != new_outgoing.target_rate ||(!new_outgoing.target_rate.IsZero() &&(last_reported_->network_estimate.loss_rate_ratio !=new_outgoing.network_estimate.loss_rate_ratio ||last_reported_->network_estimate.round_trip_time !=new_outgoing.network_estimate.round_trip_time))) {if (encoder_paused_in_last_report_ != pause_encoding)RTC_LOG(LS_INFO) << "Bitrate estimate state changed, BWE: "<< ToString(log_target_rate) << ".";encoder_paused_in_last_report_ = pause_encoding;last_reported_ = new_outgoing;return new_outgoing;}return absl::nullopt;
}

 

Call::OnTargetTransferRate

void BitrateAllocator::OnNetworkEstimateChanged(TargetTransferRate msg) {

src/video/video_send_stream_impl.cc

uint32_t VideoSendStreamImpl::OnBitrateUpdated(BitrateAllocationUpdate update) {...rtp_video_sender_->OnBitrateUpdated(update, stats_proxy_->GetSendFrameRate());...
}

src/call/rtp_video_sender.cc

void RtpVideoSender::OnBitrateUpdated(BitrateAllocationUpdate update,int framerate) {...encoder_target_rate_bps_ = fec_controller_->UpdateFecRates(payload_bitrate_bps, framerate,rtc::saturated_cast<uint8_t>(update.packet_loss_ratio * 256),loss_mask_vector_, update.round_trip_time.ms());...
}

 

这篇关于「Mutilated Webrtc」Fec Encode的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/867741

相关文章

雷动WEBRTC产品

http://www.rtcpower.com/html/leidongwebrtc.html ; 1.前言      WebRTC是一项在浏览器内部进行实时视频和音频通信的技术,是谷歌2010年以6820万美元收购Global IP Solutions公司而获得一项技术。WebRTC实现了基于网页的视频会议,标准是WHATWG 协议,目的是通过浏览器提供简单的javascript就可以

Apple quietly slips WebRTC audio, video into Safari's WebKit spec

转自:http://www.zdnet.com/article/apple-quietly-slips-webrtc-audio-video-into-safaris-webkit-spec/?from=timeline&isappinstalled=0 http://www.zdnet.com/article/apple-quietly-slips-webrtc-audio-video-

php中json_decode()和json_encode()

1.json_decode() json_decode (PHP 5 >= 5.2.0, PECL json >= 1.2.0) json_decode — 对 JSON 格式的字符串进行编码 说明 mixed json_decode ( string $json [, bool $assoc ] ) 接受一个 JSON 格式的字符串并且把它转换为 PHP 变量 参数 json

WebRTC-nack机制详解

1.NACK的含义 丢包重传(NACK)是抵抗网络错误的重要手段。NACK在接收端检测到数据丢包后,发送NACK报文到发送端;发送端根据NACK报文中的序列号,在发送缓冲区找到对应的数据包,重新发送到接收端。NACK需要发送端,发送缓冲区的支持。 WebRTC中支持音频和视频的NACK重传。我们这里只分析nack机制,不分析jitterbuffer或者neteq的更多实现。 2.WebRTC

通信工程学习:什么是FEC前向纠错

FEC:前向纠错        FEC(Forward Error Correction,前向纠错)是一种增加数据通信可信度的技术,广泛应用于计算机网络、无线通信、卫星通信等多种数据传输场景中。其基本原理和特点可以归纳如下: 一、FEC前向纠错的基本原理        FEC技术通过在发送端对原始数据添加冗余信息(即纠错码),使得接收端在接收到数据后,即使部分数据在传输过程中发生错误

【python 编码问题】UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not

插入oracle 数据发生 错误:UnicodeEncodeError: 'ascii' codec can't encode characters in position 131-136: ordinal not in range(128) 先说解决办法: python2.7版本,在开头加入下面语句 import sysreload(sys)sys.setdefaultencoding

828华为云征文|华为云Flexus X实例docker部署srs6并调优,协议使用webrtc与rtmp

828华为云征文|华为云Flexus X实例docker部署srs6并调优,协议使用webrtc与rtmp 华为云最近正在举办828 B2B企业节,Flexus X实例的促销力度非常大,特别适合那些对算力性能有高要求的小伙伴。如果你有自建MySQL、Redis、Nginx等服务的需求,一定不要错过这个机会。赶紧去看看吧! 什么是华为云Flexus X实例 华为云Flexus X实例云服务是新

WebRTC协议下的视频汇聚融合技术:EasyCVR构建高效视频交互体验

视频汇聚融合技术是指将来自不同源、不同格式、不同网络环境的视频流进行集中处理、整合和展示的技术。随着视频监控、远程会议、在线教育、直播娱乐等领域的快速发展,视频数据的规模急剧增长,对视频处理能力和效率提出了更高要求。视频汇聚融合技术通过统一的平台或系统,实现了视频资源的有效整合与高效利用,为用户提供了更加丰富、灵活的视频服务体验。 一、EasyCVR视频汇聚平台关键技术 视频编解码:采用高效的

thinkphp将结果集json_encode后渲染到textarea,然后控制器接收,进行转换数组

thinkphp将结果集json_encode后渲染到textarea,然后控制器接收,进行转换数组

华为云征文|华为云Flexus X实例docker部署srs6并调优,协议使用webrtc与rtmp

华为云征文|华为云Flexus X实例docker部署srs6并调优,协议使用webrtc与rtmp 什么是华为云Flexus X实例 华为云Flexus X实例云服务是新一代开箱即用、体验跃级、面向中小企业和开发者打造的高品价比云服务产品。Flexus云服务器X实例是新一代面向中小企业和开发者打造的柔性算力云服务器,可智能感知业务负载,适用于电商直播、企业建站、开发测试环境、游戏服务器、音视