diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index ccaaaddb..7bf117ee 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -346,7 +346,7 @@ void WebRtcTransport::sendRtpPacket(const char *buf, int len, bool flush, void * auto pkt = _packet_pool.obtain2(); // 预留rtx加入的两个字节 pkt->setCapacity((size_t)len + SRTP_MAX_TRAILER_LEN + 2); - pkt->assign(buf, len); + memcpy(pkt->data(), buf, len); onBeforeEncryptRtp(pkt->data(), len, ctx); if (_srtp_session_send->EncryptRtp(reinterpret_cast(pkt->data()), &len)) { pkt->setSize(len);