修复rtx包未修改rtp ext id的问题

This commit is contained in:
xiongziliang 2021-05-16 16:59:12 +08:00
parent d4ff84e447
commit 7cdd5ed9df
2 changed files with 6 additions and 6 deletions

View File

@ -269,7 +269,7 @@ void WebRtcTransport::inputSockData(char *buf, size_t len, RTC::TransportTuple *
}
}
void WebRtcTransport::sendRtpPacket(char *buf, size_t len, bool flush, void *ctx) {
void WebRtcTransport::sendRtpPacket(const char *buf, size_t len, bool flush, void *ctx) {
if (_srtp_session_send) {
//预留rtx加入的两个字节
CHECK(len + SRTP_MAX_TRAILER_LEN + 2 <= sizeof(_srtp_buf));
@ -281,7 +281,7 @@ void WebRtcTransport::sendRtpPacket(char *buf, size_t len, bool flush, void *ctx
}
}
void WebRtcTransport::sendRtcpPacket(char *buf, size_t len, bool flush, void *ctx){
void WebRtcTransport::sendRtcpPacket(const char *buf, size_t len, bool flush, void *ctx){
if (_srtp_session_send) {
CHECK(len + SRTP_MAX_TRAILER_LEN <= sizeof(_srtp_buf));
memcpy(_srtp_buf, buf, len);
@ -720,13 +720,13 @@ void WebRtcTransportImp::onRtp_l(const char *buf, size_t len, bool rtx) {
if (!rtx) {
//统计rtp接受情况便于生成nack rtcp包
info->nack_ctx.received(seq);
//修改ext id至统一
changeRtpExtId(rtp, _rtp_ext_id_to_type);
//时间戳转换成毫秒
auto stamp_ms = ntohl(rtp->stamp) * uint64_t(1000) / info->plan_rtp->sample_rate;
//统计rtp收到的情况好做rr汇报
info->rtcp_context_recv->onRtp(seq, stamp_ms, len);
}
//修改ext id至统一
changeRtpExtId(rtp, _rtp_ext_id_to_type);
//解析并排序rtp
info->receiver->inputRtp(info->media->type, info->plan_rtp->sample_rate, (uint8_t *) buf, len);
return;

View File

@ -63,8 +63,8 @@ public:
* @param flush flush socket
* @param ctx
*/
void sendRtpPacket(char *buf, size_t len, bool flush, void *ctx = nullptr);
void sendRtcpPacket(char *buf, size_t len, bool flush, void *ctx = nullptr);
void sendRtpPacket(const char *buf, size_t len, bool flush, void *ctx = nullptr);
void sendRtcpPacket(const char *buf, size_t len, bool flush, void *ctx = nullptr);
const EventPoller::Ptr& getPoller() const;