Add Opus frame processing fuction

This commit is contained in:
Aaro Altonen 2019-06-03 11:56:19 +03:00
parent 0f47b284f7
commit e07a9ef431
2 changed files with 35 additions and 0 deletions

View File

@ -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<kvz_rtp::frame::rtp_frame *>& 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;
}

View File

@ -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<kvz_rtp::frame::rtp_frame *>& fu,
rtp_error_t& error
);
};
};