Commit c6d2b41d by xiongziliang

完善rtp ext相关处理方法

parent 5f05df98
...@@ -668,7 +668,7 @@ void WebRtcTransportImp::onRtcp(const char *buf, size_t len) { ...@@ -668,7 +668,7 @@ void WebRtcTransportImp::onRtcp(const char *buf, size_t len) {
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
void WebRtcTransportImp::changeRtpExtId(const RtpHeader *header, bool is_recv, bool is_rtx) const{ void WebRtcTransportImp::changeRtpExtId(const RtpPayloadInfo *info, const RtpHeader *header, bool is_recv, bool is_rtx) const{
auto ext_map = RtpExt::getExtValue(header); auto ext_map = RtpExt::getExtValue(header);
for (auto &pr : ext_map) { for (auto &pr : ext_map) {
if (is_recv) { if (is_recv) {
...@@ -732,7 +732,7 @@ void WebRtcTransportImp::onRtp_l(const char *buf, size_t len, bool rtx) { ...@@ -732,7 +732,7 @@ void WebRtcTransportImp::onRtp_l(const char *buf, size_t len, bool rtx) {
info->rtcp_context_recv->onRtp(seq, stamp_ms, len); info->rtcp_context_recv->onRtp(seq, stamp_ms, len);
} }
//修改ext id至统一 //修改ext id至统一
changeRtpExtId(rtp, true); changeRtpExtId(info.get(), rtp, true, rtx);
//解析并排序rtp //解析并排序rtp
info->receiver->inputRtp(info->media->type, info->plan_rtp->sample_rate, (uint8_t *) buf, len); info->receiver->inputRtp(info->media->type, info->plan_rtp->sample_rate, (uint8_t *) buf, len);
return; return;
...@@ -817,12 +817,12 @@ void WebRtcTransportImp::onBeforeEncryptRtp(const char *buf, size_t &len, void * ...@@ -817,12 +817,12 @@ void WebRtcTransportImp::onBeforeEncryptRtp(const char *buf, size_t &len, void *
if (!pr->first || !pr->second->plan_rtx) { if (!pr->first || !pr->second->plan_rtx) {
//普通的rtp,或者不支持rtx, 修改目标pt和ssrc //普通的rtp,或者不支持rtx, 修改目标pt和ssrc
changeRtpExtId(header, false, false); changeRtpExtId(pr->second, header, false, false);
header->pt = pr->second->plan_rtp->pt; header->pt = pr->second->plan_rtp->pt;
header->ssrc = htonl(pr->second->answer_ssrc_rtp); header->ssrc = htonl(pr->second->answer_ssrc_rtp);
} else { } else {
//重传的rtp, rtx //重传的rtp, rtx
changeRtpExtId(header, false, true); changeRtpExtId(pr->second, header, false, true);
header->pt = pr->second->plan_rtx->pt; header->pt = pr->second->plan_rtx->pt;
if (pr->second->answer_ssrc_rtx) { if (pr->second->answer_ssrc_rtx) {
//有rtx单独的ssrc,有些情况下,浏览器支持rtx,但是未指定rtx单独的ssrc //有rtx单独的ssrc,有些情况下,浏览器支持rtx,但是未指定rtx单独的ssrc
......
...@@ -338,7 +338,6 @@ private: ...@@ -338,7 +338,6 @@ private:
SdpAttrCandidate::Ptr getIceCandidate() const; SdpAttrCandidate::Ptr getIceCandidate() const;
bool canSendRtp() const; bool canSendRtp() const;
bool canRecvRtp() const; bool canRecvRtp() const;
void changeRtpExtId(const RtpHeader *header, bool is_recv, bool is_rtx = false) const;
class RtpPayloadInfo { class RtpPayloadInfo {
public: public:
...@@ -359,6 +358,7 @@ private: ...@@ -359,6 +358,7 @@ private:
void onSortedRtp(RtpPayloadInfo &info, RtpPacket::Ptr rtp); void onSortedRtp(RtpPayloadInfo &info, RtpPacket::Ptr rtp);
void onSendNack(RtpPayloadInfo &info, const FCI_NACK &nack); void onSendNack(RtpPayloadInfo &info, const FCI_NACK &nack);
void changeRtpExtId(const RtpPayloadInfo *info, const RtpHeader *header, bool is_recv, bool is_rtx = false) const;
private: private:
uint16_t _rtx_seq[2] = {0, 0}; uint16_t _rtx_seq[2] = {0, 0};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论