Skip to content

Commit

Permalink
rtpext: add doxygen comments (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh authored Jun 13, 2023
1 parent 3f39a88 commit 5b38323
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
10 changes: 6 additions & 4 deletions include/re_rtpext.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

#define RTPEXT_HDR_SIZE 4
#define RTPEXT_TYPE_MAGIC 0xbede
#define RTPEXT_TYPE_MAGIC 0xbede /* One-Byte header */

enum {
RTPEXT_ID_MIN = 1,
Expand All @@ -22,10 +22,12 @@ enum {
RTPEXT_LEN_MAX = 16,
};


/** Defines an RTP header extension */
struct rtpext {
unsigned id:4;
unsigned len:4;
uint8_t data[RTPEXT_LEN_MAX];
unsigned id:4; /**< Identifier */
unsigned len:4; /**< Length of data [bytes] */
uint8_t data[RTPEXT_LEN_MAX]; /**< Data field */
};


Expand Down
28 changes: 27 additions & 1 deletion src/rtpext/rtpext.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@


/*
* RFC 5285 A General Mechanism for RTP Header Extensions
* RFC 8285 A General Mechanism for RTP Header Extensions
*
* - One-Byte Header: Supported
* - Two-Byte Header: Not supported
*/


/**
* Encode the One-Byte header for all RTP extensions
*
* @param mb Buffer to encode into
* @param num_bytes Total size for all RTP extensions
*
* @return 0 if success, otherwise errorcode
*/
int rtpext_hdr_encode(struct mbuf *mb, size_t num_bytes)
{
int err = 0;
Expand All @@ -44,6 +52,16 @@ int rtpext_hdr_encode(struct mbuf *mb, size_t num_bytes)
}


/**
* Encode an RTP header extension with One-Byte header
*
* @param mb Buffer to encode into
* @param id Identifier
* @param len Length of data field
* @param data Data bytes
*
* @return 0 if success, otherwise errorcode
*/
int rtpext_encode(struct mbuf *mb, uint8_t id, size_t len,
const uint8_t *data)
{
Expand Down Expand Up @@ -73,6 +91,14 @@ int rtpext_encode(struct mbuf *mb, uint8_t id, size_t len,
}


/**
* Decode an RTP header extension with One-Byte header
*
* @param ext RTP Extension object
* @param mb Buffer to decode from
*
* @return 0 if success, otherwise errorcode
*/
int rtpext_decode(struct rtpext *ext, struct mbuf *mb)
{
uint8_t v;
Expand Down

0 comments on commit 5b38323

Please sign in to comment.