opus: add helper function to extract voice activity information

BUG=webrtc:11643

Change-Id: I3cebc40916de0e4b0f5e41f5fda97dd53f76e4e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176740
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31490}
This commit is contained in:
Philipp Hancke
2020-06-10 14:21:44 +02:00
committed by Commit Bot
parent 0ca13d97d2
commit 0fd1ef135c
3 changed files with 118 additions and 27 deletions

View File

@ -510,6 +510,22 @@ int WebRtcOpus_FecDurationEst(const uint8_t* payload,
int WebRtcOpus_PacketHasFec(const uint8_t* payload,
size_t payload_length_bytes);
/****************************************************************************
* WebRtcOpus_PacketHasVoiceActivity(...)
*
* This function returns the SILK VAD information encoded in the opus packet.
* For CELT-only packets that do not have VAD information, it returns -1.
* Input:
* - payload : Encoded data pointer
* - payload_length_bytes : Bytes of encoded data
*
* Return value : 0 - no frame had the VAD flag set.
* 1 - at least one frame had the VAD flag set.
* -1 - VAD status could not be determined.
*/
int WebRtcOpus_PacketHasVoiceActivity(const uint8_t* payload,
size_t payload_length_bytes);
#ifdef __cplusplus
} // extern "C"
#endif