From e6f4f1f8aa2278a054f768fc076b4f93d2a4c473 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 13 Oct 2020 16:05:39 +0200 Subject: [PATCH] Fixed trailing zeroes in WebRTC RTP packets --- src/output/output_webrtc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/output/output_webrtc.cpp b/src/output/output_webrtc.cpp index 117dd8b5..572f67f6 100644 --- a/src/output/output_webrtc.cpp +++ b/src/output/output_webrtc.cpp @@ -1610,13 +1610,13 @@ namespace Mist{ buffer.push_back((rtcTrack.SSRC >> 8) & 0xFF); // ssrc of receiver buffer.push_back((rtcTrack.SSRC) & 0xFF); // ssrc of receiver + // protect. + int buffer_size_in_bytes = (int)buffer.size(); + // space for protection size_t trailer_space = SRTP_MAX_TRAILER_LEN + 4; for (size_t i = 0; i < trailer_space; ++i){buffer.push_back(0x00);} - // protect. - int buffer_size_in_bytes = (int)buffer.size(); - if (doDTLS){ if (srtpWriter.protectRtcp(&buffer[0], &buffer_size_in_bytes) != 0){ ERROR_MSG("Failed to protect the RTCP message."); @@ -1661,13 +1661,13 @@ namespace Mist{ buffer.push_back(0x00); // BLP: Bitmask of following losses. (not implemented atm). buffer.push_back(0x00); // BLP: Bitmask of following losses. (not implemented atm). + // protect. + int buffer_size_in_bytes = (int)buffer.size(); + // space for protection size_t trailer_space = SRTP_MAX_TRAILER_LEN + 4; for (size_t i = 0; i < trailer_space; ++i){buffer.push_back(0x00);} - // protect. - int buffer_size_in_bytes = (int)buffer.size(); - if (doDTLS){ if (srtpWriter.protectRtcp(&buffer[0], &buffer_size_in_bytes) != 0){ ERROR_MSG("Failed to protect the RTCP message.");