multiplex: Detect RTP packets in reception_flow

This commit is contained in:
Heikki Tampio 2023-06-14 13:01:39 +03:00
parent 38c12ba6d2
commit 60f6d83bcf
2 changed files with 10 additions and 4 deletions

View File

@ -675,12 +675,18 @@ void uvgrtp::reception_flow::process_packet(int rce_flags)
}
/* -------------------- ZRTP check -------------------- */
if (ntohl((uint32_t)ptr[4]) == 0x5a525450) {
if (ntohl(*(uint32_t*)&ptr[4]) == 0x5a525450) {
// TODO: Add functionality
UVG_LOG_INFO("ZRTP message");
UVG_LOG_INFO("ZRTP packet");
}
/* -------------------- RTP check -------------------- */
uint8_t version = (*(uint8_t*)&ptr[0] >> 6) & 0x3;
if (version == 0x2) {
UVG_LOG_INFO("RTP packet");
}
// Here we don't lock ring mutex because the chaging is only done above.
// NOTE: If there is a need for multiple processing threads, the read should be guarded
switch ((ret = (*handler.second.primary)(ring_buffer_[ring_read_index_].read,

View File

@ -109,7 +109,7 @@ rtp_error_t uvgrtp::zrtp_msg::receiver::recv_msg(std::shared_ptr<uvgrtp::socket>
return RTP_INVALID_VALUE;
}
if (msg->header.magic != ZRTP_MAGIC) {
if (ntohl(msg->header.magic) != ZRTP_MAGIC) {
UVG_LOG_WARN("Received invalid ZRTP magic");
return RTP_INVALID_VALUE;
}