WIP: стабилизация звонков и E2EE + инструменты сборки WebRTC

This commit is contained in:
2026-03-25 22:20:24 +05:00
parent 530047c5d0
commit eea650face
8 changed files with 1119 additions and 219 deletions

View File

@@ -0,0 +1,54 @@
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index 17cf859ed8..b9d9ab14c8 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -693,10 +693,20 @@ void ChannelReceive::ReceivePacket(const uint8_t* packet,
const std::vector<uint32_t> csrcs(header.arrOfCSRCs,
header.arrOfCSRCs + header.numCSRCs);
+ const uint8_t additional_data_bytes[8] = {
+ 0,
+ 0,
+ 0,
+ 0,
+ static_cast<uint8_t>((header.timestamp >> 24) & 0xff),
+ static_cast<uint8_t>((header.timestamp >> 16) & 0xff),
+ static_cast<uint8_t>((header.timestamp >> 8) & 0xff),
+ static_cast<uint8_t>(header.timestamp & 0xff),
+ };
const FrameDecryptorInterface::Result decrypt_result =
frame_decryptor_->Decrypt(
cricket::MEDIA_TYPE_AUDIO, csrcs,
- /*additional_data=*/nullptr,
+ /*additional_data=*/additional_data_bytes,
rtc::ArrayView<const uint8_t>(payload, payload_data_length),
decrypted_audio_payload);
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 4a2700177b..93283c2e78 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -320,10 +320,21 @@ int32_t ChannelSend::SendRtpAudio(AudioFrameType frameType,
// Encrypt the audio payload into the buffer.
size_t bytes_written = 0;
+ const uint8_t additional_data_bytes[8] = {
+ 0,
+ 0,
+ 0,
+ 0,
+ static_cast<uint8_t>((rtp_timestamp_without_offset >> 24) & 0xff),
+ static_cast<uint8_t>((rtp_timestamp_without_offset >> 16) & 0xff),
+ static_cast<uint8_t>((rtp_timestamp_without_offset >> 8) & 0xff),
+ static_cast<uint8_t>(rtp_timestamp_without_offset & 0xff),
+ };
+
int encrypt_status = frame_encryptor_->Encrypt(
cricket::MEDIA_TYPE_AUDIO, rtp_rtcp_->SSRC(),
- /*additional_data=*/nullptr, payload, encrypted_audio_payload,
- &bytes_written);
+ /*additional_data=*/additional_data_bytes, payload,
+ encrypted_audio_payload, &bytes_written);
if (encrypt_status != 0) {
RTC_DLOG(LS_ERROR)
<< "Channel::SendData() failed encrypt audio payload: "