Skip to content

Commit

Permalink
Fix space indents
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Oct 16, 2024
1 parent 8c151bb commit 4d1a420
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
6 changes: 2 additions & 4 deletions src/dpp/dave/codec_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ unencrypted_frame_header_size BytesCoveringH264PPS(const uint8_t* payload, const
// check if this is an emulation prevention byte
// which we skip over
if (bit_index == 0) {
if (byte_index >= 2 && payload_byte == emulation_prevention_byte &&
payload[byte_index - 1] == 0 && payload[byte_index - 2] == 0) {
if (byte_index >= 2 && payload_byte == emulation_prevention_byte && payload[byte_index - 1] == 0 && payload[byte_index - 2] == 0) {
payload_bit_index += 8;
continue;
}
Expand Down Expand Up @@ -103,8 +102,7 @@ std::optional<index_start_code_size_pair> next_h26x_nalu_index(const uint8_t* bu
i += nalu_short_start_sequence_size;
} else if (buffer[i + 2] == start_code_end_byte_value) {
// third byte matches the start code end byte, might be a start code sequence
if (buffer[i + 1] == start_code_leading_bytes_value &&
buffer[i] == start_code_leading_bytes_value) {
if (buffer[i + 1] == start_code_leading_bytes_value && buffer[i] == start_code_leading_bytes_value) {
// confirmed start sequence {0, 0, 1}
auto nal_unit_start_index = i + nalu_short_start_sequence_size;

Expand Down
3 changes: 1 addition & 2 deletions src/dpp/dave/cryptor_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ bool aead_cipher_manager::can_process_nonce(key_generation generation, truncated
}

auto wrapped_big_nonce = compute_wrapped_big_nonce(generation, nonce);
return wrapped_big_nonce > *newest_processed_nonce ||
std::find(missing_nonces.rbegin(), missing_nonces.rend(), wrapped_big_nonce) != missing_nonces.rend();
return wrapped_big_nonce > *newest_processed_nonce || std::find(missing_nonces.rbegin(), missing_nonces.rend(), wrapped_big_nonce) != missing_nonces.rend();
}

cipher_interface* aead_cipher_manager::get_cipher(key_generation generation)
Expand Down
14 changes: 7 additions & 7 deletions src/dpp/dave/decryptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ size_t decryptor::decrypt(media_type this_media_type, array_view<const uint8_t>
scope_exit cleanup([&] { return_frame_processor(std::move(local_frame)); });

// Skip decrypting for silence frames
if (this_media_type == media_audio && encrypted_frame.size() == OPUS_SILENCE_PACKET.size() &&
std::memcmp(encrypted_frame.data(), OPUS_SILENCE_PACKET.data(), OPUS_SILENCE_PACKET.size()) == 0) {
if (this_media_type == media_audio && encrypted_frame.size() == OPUS_SILENCE_PACKET.size() && std::memcmp(encrypted_frame.data(), OPUS_SILENCE_PACKET.data(), OPUS_SILENCE_PACKET.size()) == 0) {
creator.log(dpp::ll_trace, "decrypt skipping silence of size: " + std::to_string(encrypted_frame.size()));
if (encrypted_frame.data() != frame.data()) {
std::memcpy(frame.data(), encrypted_frame.data(), encrypted_frame.size());
Expand Down Expand Up @@ -125,11 +124,12 @@ size_t decryptor::decrypt(media_type this_media_type, array_view<const uint8_t>
}
else {
stats[this_media_type].decrypt_failure++;
creator.log(dpp::ll_warning, "decrypt failed, no valid cryptor found, type: " + std::string(this_media_type ? "video" : "audio") +
", encrypted frame size: " + std::to_string(encrypted_frame.size()) +
", plaintext frame size: " + std::to_string(frame.size()) +
", number of cryptor managers: " + std::to_string(cryptor_managers.size()) +
", pass through enabled: " + std::string(can_use_pass_through ? "yes" : "no")
creator.log(dpp::ll_warning,
"decrypt failed, no valid cryptor found, type: " + std::string(this_media_type ? "video" : "audio") +
", encrypted frame size: " + std::to_string(encrypted_frame.size()) +
", plaintext frame size: " + std::to_string(frame.size()) +
", number of cryptor managers: " + std::to_string(cryptor_managers.size()) +
", pass through enabled: " + std::string(can_use_pass_through ? "yes" : "no")
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/dpp/dave/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ using signature_version = uint8_t;
*/
protocol_version max_protocol_version();

}
}

0 comments on commit 4d1a420

Please sign in to comment.