Skip to content

Commit a0f5bc3

Browse files
committed
feat: replace to snake case
1 parent 5c45f94 commit a0f5bc3

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/dpp/discordvoiceclient.cpp

+21-21
Original file line numberDiff line numberDiff line change
@@ -1275,13 +1275,13 @@ discord_voice_client& discord_voice_client::send_audio_raw(uint16_t* audio_data,
12751275
return send_audio_raw((uint16_t*)packet.data(), packet.size());
12761276
}
12771277

1278-
opus_int32 encodedAudioMaxLength = (opus_int32)length;
1279-
std::vector<uint8_t> encodedAudioData(encodedAudioMaxLength);
1280-
size_t encodedAudioLength = encodedAudioMaxLength;
1278+
opus_int32 encoded_audio_max_length = (opus_int32)length;
1279+
std::vector<uint8_t> encoded_audio(encoded_audio_max_length);
1280+
size_t encoded_audio_length = encoded_audio_max_length;
12811281

1282-
encodedAudioLength = this->encode((uint8_t*)audio_data, length, encodedAudioData.data(), encodedAudioLength);
1282+
encoded_audio_length = this->encode((uint8_t*)audio_data, length, encoded_audio.data(), encoded_audio_length);
12831283

1284-
send_audio_opus(encodedAudioData.data(), encodedAudioLength);
1284+
send_audio_opus(encoded_audio.data(), encoded_audio_length);
12851285
#else
12861286
throw dpp::voice_exception(err_no_voice_support, "Voice support not enabled in this build of D++");
12871287
#endif
@@ -1301,25 +1301,25 @@ discord_voice_client& discord_voice_client::send_audio_opus(uint8_t* opus_packet
13011301

13021302
discord_voice_client& discord_voice_client::send_audio_opus(uint8_t* opus_packet, const size_t length, uint64_t duration) {
13031303
#if HAVE_VOICE
1304-
int frameSize = (int)(48 * duration * (timescale / 1000000));
1305-
opus_int32 encodedAudioMaxLength = (opus_int32)length;
1306-
std::vector<uint8_t> encodedAudioData(encodedAudioMaxLength);
1307-
size_t encodedAudioLength = encodedAudioMaxLength;
1304+
int frame_size = (int)(48 * duration * (timescale / 1000000));
1305+
opus_int32 encoded_audio_max_length = (opus_int32)length;
1306+
std::vector<uint8_t> encoded_audio(encoded_audio_max_length);
1307+
size_t encoded_audio_length = encoded_audio_max_length;
13081308

1309-
encodedAudioLength = length;
1310-
encodedAudioData.reserve(length);
1311-
memcpy(encodedAudioData.data(), opus_packet, length);
1309+
encoded_audio_length = length;
1310+
encoded_audio.reserve(length);
1311+
memcpy(encoded_audio.data(), opus_packet, length);
13121312

13131313
++sequence;
13141314
rtp_header header(sequence, timestamp, (uint32_t)ssrc);
13151315

13161316
/* Expected payload size is unencrypted header + encrypted opus packet + unencrypted 32 bit nonce */
1317-
size_t packet_siz = sizeof(header) + (encodedAudioLength + crypto_aead_xchacha20poly1305_IETF_ABYTES) + sizeof(packet_nonce);
1317+
size_t packet_siz = sizeof(header) + (encoded_audio_length + crypto_aead_xchacha20poly1305_IETF_ABYTES) + sizeof(packet_nonce);
13181318

1319-
std::vector<uint8_t> audioDataPacket(packet_siz);
1319+
std::vector<uint8_t> payload(packet_siz);
13201320

13211321
/* Set RTP header */
1322-
std::memcpy(audioDataPacket.data(), &header, sizeof(header));
1322+
std::memcpy(payload.data(), &header, sizeof(header));
13231323

13241324
/* Convert nonce to big-endian */
13251325
uint32_t noncel = htonl(packet_nonce);
@@ -1330,10 +1330,10 @@ discord_voice_client& discord_voice_client::send_audio_opus(uint8_t* opus_packet
13301330

13311331
/* Execute */
13321332
crypto_aead_xchacha20poly1305_ietf_encrypt(
1333-
audioDataPacket.data() + sizeof(header),
1333+
payload.data() + sizeof(header),
13341334
nullptr,
1335-
encodedAudioData.data(),
1336-
encodedAudioLength,
1335+
encoded_audio.data(),
1336+
encoded_audio_length,
13371337
/* The RTP Header as Additional Data */
13381338
reinterpret_cast<const unsigned char *>(&header),
13391339
sizeof(header),
@@ -1342,10 +1342,10 @@ discord_voice_client& discord_voice_client::send_audio_opus(uint8_t* opus_packet
13421342
secret_key);
13431343

13441344
/* Append the 4 byte nonce to the resulting payload */
1345-
std::memcpy(audioDataPacket.data() + audioDataPacket.size() - sizeof(noncel), &noncel, sizeof(noncel));
1345+
std::memcpy(payload.data() + payload.size() - sizeof(noncel), &noncel, sizeof(noncel));
13461346

1347-
this->send(reinterpret_cast<const char*>(audioDataPacket.data()), audioDataPacket.size(), duration);
1348-
timestamp += frameSize;
1347+
this->send(reinterpret_cast<const char*>(payload.data()), payload.size(), duration);
1348+
timestamp += frame_size;
13491349

13501350
/* Increment for next packet */
13511351
packet_nonce++;

0 commit comments

Comments
 (0)