Rewrite generic RTP frame sending

This commit is contained in:
Aaro Altonen 2019-06-12 11:19:18 +03:00
parent f8d6ec6361
commit 18f88017c2
1 changed files with 6 additions and 9 deletions

View File

@ -15,20 +15,17 @@
#include "util.hh"
#include "writer.hh"
// TODO implement frame splitting if dataLen > MTU
// TODO implement frame splitting if data_len > MTU
rtp_error_t kvz_rtp::generic::push_generic_frame(connection *conn, uint8_t *data, size_t data_len, uint32_t timestamp)
{
rtp_error_t ret;
if (data_len > MAX_PAYLOAD)
if (data_len > MAX_PAYLOAD) {
LOG_WARN("packet is larger (%zu bytes) than MAX_PAYLOAD (%u bytes)", data_len, MAX_PAYLOAD);
if ((ret = kvz_rtp::sender::write_rtp_header(conn, timestamp)) != RTP_OK) {
LOG_ERROR("Failed to write RTP Header for Opus frame!");
return ret;
}
return kvz_rtp::sender::write_payload(conn, data, data_len);
uint8_t header[kvz_rtp::frame::HEADER_SIZE_RTP];
conn->fill_rtp_header(header, timestamp);
return kvz_rtp::sender::write_frame(conn, header, sizeof(header), data, data_len);
}
kvz_rtp::frame::rtp_frame *kvz_rtp::generic::process_generic_frame(