MCPcopy Create free account
hub / github.com/ClassicOldSong/Apollo / encode_audio

Function encode_audio

src/stream.cpp:257–265  ·  view source on GitHub ↗

return bytes written on success return -1 on error

Source from the content-addressed store, hash-verified

255 // return bytes written on success
256 // return -1 on error
257 static inline int encode_audio(bool encrypted, const audio::buffer_t &plaintext, uint8_t *destination, crypto::aes_t &iv, crypto::cipher::cbc_t &cbc) {
258 // If encryption isn't enabled
259 if (!encrypted) {
260 std::copy(std::begin(plaintext), std::end(plaintext), destination);
261 return plaintext.size();
262 }
263
264 return cbc.encrypt(std::string_view {(char *) std::begin(plaintext), plaintext.size()}, destination, &iv);
265 }
266
267 static inline void while_starting_do_nothing(std::atomic<session::state_e> &state) {
268 while (state.load(std::memory_order_acquire) == session::state_e::STARTING) {

Callers 1

audioBroadcastThreadFunction · 0.85

Calls 2

encryptMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected