Allow NetEQ to use real packet durations.
This is a copy of http://review.webrtc.org/864014/ This adds a FuncDurationEst to each codec instance which estimates the duration of a packet given the packet contents and the duration of the previous packet. By default, this simply returns the duration of the previous packet (which is what is currently assumed to be the duration of all future packets). This patch also provides an initial implementation of this function for G.711 which returns the actual number of samples in the packet. BUG=issue1015 Review URL: https://webrtc-codereview.appspot.com/935016 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3129 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -164,6 +164,16 @@ WebRtc_Word16 WebRtcG711_DecodeU(void *state,
|
||||
return (len);
|
||||
}
|
||||
|
||||
int WebRtcG711_DurationEst(void* state,
|
||||
const uint8_t* payload,
|
||||
int payload_length_bytes) {
|
||||
(void)state;
|
||||
(void)payload;
|
||||
/* G.711 is one byte per sample, so we can just return the number of
|
||||
bytes. */
|
||||
return payload_length_bytes;
|
||||
}
|
||||
|
||||
WebRtc_Word16 WebRtcG711_Version(char* version, WebRtc_Word16 lenBytes)
|
||||
{
|
||||
strncpy(version, "2.0.0", lenBytes);
|
||||
|
||||
@@ -123,6 +123,27 @@ WebRtc_Word16 WebRtcG711_DecodeU(void *state,
|
||||
WebRtc_Word16 *decoded,
|
||||
WebRtc_Word16 *speechType);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcG711_DurationEst(...)
|
||||
*
|
||||
* This function estimates the duration of a G711 packet in samples.
|
||||
*
|
||||
* Input:
|
||||
* - state : Dummy state to make this codec look more like
|
||||
* other codecs
|
||||
* - payload : Encoded data
|
||||
* - payloadLengthBytes : Bytes in encoded vector
|
||||
*
|
||||
* Return value : The duration of the packet in samples, which is
|
||||
* just payload_length_bytes, since G.711 uses one
|
||||
* byte per sample.
|
||||
*/
|
||||
|
||||
int WebRtcG711_DurationEst(void* state,
|
||||
const uint8_t* payload,
|
||||
int payload_length_bytes);
|
||||
|
||||
/**********************************************************************
|
||||
* WebRtcG711_Version(...)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user