@@ -1275,13 +1275,13 @@ discord_voice_client& discord_voice_client::send_audio_raw(uint16_t* audio_data,
1275
1275
return send_audio_raw ((uint16_t *)packet.data (), packet.size ());
1276
1276
}
1277
1277
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 ;
1281
1281
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 );
1283
1283
1284
- send_audio_opus (encodedAudioData .data (), encodedAudioLength );
1284
+ send_audio_opus (encoded_audio .data (), encoded_audio_length );
1285
1285
#else
1286
1286
throw dpp::voice_exception (err_no_voice_support, " Voice support not enabled in this build of D++" );
1287
1287
#endif
@@ -1301,25 +1301,25 @@ discord_voice_client& discord_voice_client::send_audio_opus(uint8_t* opus_packet
1301
1301
1302
1302
discord_voice_client& discord_voice_client::send_audio_opus (uint8_t * opus_packet, const size_t length, uint64_t duration) {
1303
1303
#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 ;
1308
1308
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);
1312
1312
1313
1313
++sequence;
1314
1314
rtp_header header (sequence, timestamp, (uint32_t )ssrc);
1315
1315
1316
1316
/* 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);
1318
1318
1319
- std::vector<uint8_t > audioDataPacket (packet_siz);
1319
+ std::vector<uint8_t > payload (packet_siz);
1320
1320
1321
1321
/* Set RTP header */
1322
- std::memcpy (audioDataPacket .data (), &header, sizeof (header));
1322
+ std::memcpy (payload .data (), &header, sizeof (header));
1323
1323
1324
1324
/* Convert nonce to big-endian */
1325
1325
uint32_t noncel = htonl (packet_nonce);
@@ -1330,10 +1330,10 @@ discord_voice_client& discord_voice_client::send_audio_opus(uint8_t* opus_packet
1330
1330
1331
1331
/* Execute */
1332
1332
crypto_aead_xchacha20poly1305_ietf_encrypt (
1333
- audioDataPacket .data () + sizeof (header),
1333
+ payload .data () + sizeof (header),
1334
1334
nullptr ,
1335
- encodedAudioData .data (),
1336
- encodedAudioLength ,
1335
+ encoded_audio .data (),
1336
+ encoded_audio_length ,
1337
1337
/* The RTP Header as Additional Data */
1338
1338
reinterpret_cast <const unsigned char *>(&header),
1339
1339
sizeof (header),
@@ -1342,10 +1342,10 @@ discord_voice_client& discord_voice_client::send_audio_opus(uint8_t* opus_packet
1342
1342
secret_key);
1343
1343
1344
1344
/* 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));
1346
1346
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 ;
1349
1349
1350
1350
/* Increment for next packet */
1351
1351
packet_nonce++;
0 commit comments