Add binary protocol v2 & v3 to websocket

This commit is contained in:
Terrence
2025-04-28 16:29:33 +08:00
parent 1f03d770cc
commit 5f8389c135
5 changed files with 86 additions and 13 deletions

View File

@@ -207,6 +207,11 @@ bool MqttProtocol::OpenAudioChannel() {
}
udp_ = Board::GetInstance().CreateUdp();
udp_->OnMessage([this](const std::string& data) {
/*
* UDP Encrypted OPUS Packet Format:
* |type 1u|flags 1u|payload_len 2u|ssrc 4u|timestamp 4u|sequence 4u|
* |payload payload_len|
*/
if (data.size() < sizeof(aes_nonce_)) {
ESP_LOGE(TAG, "Invalid audio packet size: %zu", data.size());
return;