From e07a9ef4316027c9c01fc6608430778abf0276b1 Mon Sep 17 00:00:00 2001 From: Aaro Altonen Date: Mon, 3 Jun 2019 11:56:19 +0300 Subject: [PATCH] Add Opus frame processing fuction --- src/rtp_opus.cc | 19 +++++++++++++++++++ src/rtp_opus.hh | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/rtp_opus.cc b/src/rtp_opus.cc index 3d41786..a88f537 100644 --- a/src/rtp_opus.cc +++ b/src/rtp_opus.cc @@ -40,3 +40,22 @@ rtp_error_t kvz_rtp::opus::push_opus_frame(connection *conn, uint8_t *data, uint return RTPGeneric::pushGenericFrame(conn, data, dataLen, 0); #endif } + +kvz_rtp::frame::rtp_frame *kvz_rtp::opus::process_opus_frame( + kvz_rtp::frame::rtp_frame *frame, + std::vector& fu, + rtp_error_t& error +) +{ + (void)fu; + + if (!frame) { + error = RTP_INVALID_VALUE; + + LOG_ERROR("Invalid value, unable to process frame!"); + return nullptr; + } + + error = RTP_OK; + return frame; +} diff --git a/src/rtp_opus.hh b/src/rtp_opus.hh index f1be18f..0c3066d 100644 --- a/src/rtp_opus.hh +++ b/src/rtp_opus.hh @@ -11,5 +11,21 @@ namespace kvz_rtp { }; rtp_error_t push_opus_frame(connection *conn, uint8_t *data, uint32_t data_len, uint32_t timestamp); + + /* Process the incoming Opus frame + * The RTP frame "frame" given as parameter should be considered invalid after calling this function + * and no operatios should be performed on it after the function has returned. + * + * On success, a valid RTP frame is returned and "error" is set to RTP_OK + * + * If the original frame has been split and this is a fragment of it, the fragment is returned + * and "error" is set to RTP_NOT_READY + * + * If the frame is invalid, nullptr is returned and "error" is set to RTP_INVALID_VALUE (is possible) */ + kvz_rtp::frame::rtp_frame *process_opus_frame( + kvz_rtp::frame::rtp_frame *frame, + std::vector& fu, + rtp_error_t& error + ); }; };