Skip to content

Commit

Permalink
Merge pull request #1 from mirkobrankovic/videoroom-audiolevel-event
Browse files Browse the repository at this point in the history
Videoroom audiolevel event
  • Loading branch information
do-not-set-2fa committed Feb 10, 2017
2 parents 764005c + 536a113 commit baa47c6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,19 @@ int janus_rtp_header_extension_parse_audio_level(char *buf, int len, int id, int
return 0;
}

int janus_rtp_header_extension_parse_audio_level_and_return(char *buf, int len, int id, int *level) {
uint8_t byte = 0;
if(janus_rtp_header_extension_find(buf, len, id, &byte, NULL) < 0)
return 0;
/* a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level */
// int v = (byte & 0x80) >> 7;
int value = byte & 0x7F;
// JANUS_LOG(LOG_DBG, "%02x --> v=%d, level=%d\n", byte, v, value);
if(level)
*level = value;
return value;
}

int janus_rtp_header_extension_parse_video_orientation(char *buf, int len, int id,
gboolean *c, gboolean *f, gboolean *r1, gboolean *r0) {
uint8_t byte = 0;
Expand Down
8 changes: 8 additions & 0 deletions rtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ const char *janus_rtp_header_extension_get_from_id(const char *sdp, int id);
* @returns 0 if found, -1 otherwise */
int janus_rtp_header_extension_parse_audio_level(char *buf, int len, int id, int *level);

/*! \brief Helper to parse a ssrc-audio-level RTP extension (https://tools.ietf.org/html/rfc6464)
* @param[in] buf The packet data
* @param[in] len The packet data length in bytes
* @param[in] id The extension ID to look for
* @param[out] level The level value in dBov (0=max, 127=min)
* @returns dBov level of audio, 0 otherwise */
int janus_rtp_header_extension_parse_audio_level_and_return(char *buf, int len, int id, int *level);

/*! \brief Helper to parse a video-orientation RTP extension (http://www.3gpp.org/ftp/Specs/html-info/26114.htm)
* @param[in] buf The packet data
* @param[in] len The packet data length in bytes
Expand Down

0 comments on commit baa47c6

Please sign in to comment.