Guarding certain operations, e.g. bandwidth estimation, RTCP statistics update etc., not to be run on sync RTPS.
BUG=issue1770
R=tina.legrand@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/1485004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4052 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/neteq/recin.c b/webrtc/modules/audio_coding/neteq/recin.c
index 15d618e..17bea5f 100644
--- a/webrtc/modules/audio_coding/neteq/recin.c
+++ b/webrtc/modules/audio_coding/neteq/recin.c
@@ -17,13 +17,12 @@
#include <string.h>
-#include "signal_processing_library.h"
-
#include "automode.h"
#include "dtmf_buffer.h"
+#include "mcu_dsp_common.h"
#include "neteq_defines.h"
#include "neteq_error_codes.h"
-
+#include "signal_processing_library.h"
int WebRtcNetEQ_RecInInternal(MCUInst_t *MCU_inst, RTPPacket_t *RTPpacketInput,
uint32_t uw32_timeRec)
@@ -36,6 +35,8 @@
int curr_Codec;
int16_t isREDPayload = 0;
int32_t temp_bufsize;
+ int is_sync_rtp = MCU_inst->av_sync && WebRtcNetEQ_IsSyncPayload(
+ RTPpacketInput->payload, RTPpacketInput->payloadLen);
#ifdef NETEQ_RED_CODEC
RTPPacket_t* RTPpacketPtr[2]; /* Support for redundancy up to 2 payloads */
RTPpacketPtr[0] = &RTPpacket[0];
@@ -77,15 +78,23 @@
}
- /* Call RTCP statistics */
- i_ok |= WebRtcNetEQ_RTCPUpdate(&(MCU_inst->RTCP_inst), RTPpacket[0].seqNumber,
- RTPpacket[0].timeStamp, uw32_timeRec);
+ if (!is_sync_rtp) { /* Update only if it not sync packet. */
+ /* Call RTCP statistics if it is not sync packet. */
+ i_ok |= WebRtcNetEQ_RTCPUpdate(&(MCU_inst->RTCP_inst),
+ RTPpacket[0].seqNumber,
+ RTPpacket[0].timeStamp, uw32_timeRec);
+ }
/* If Redundancy is supported and this is the redundancy payload, separate the payloads */
#ifdef NETEQ_RED_CODEC
if (RTPpacket[0].payloadType == WebRtcNetEQ_DbGetPayload(&MCU_inst->codec_DB_inst,
kDecoderRED))
{
+ if (is_sync_rtp)
+ {
+ /* Sync packet should not have RED payload type. */
+ return RECIN_SYNC_RTP_NOT_ACCEPTABLE;
+ }
/* Split the payload into a main and a redundancy payloads */
i_ok = WebRtcNetEQ_RedundancySplit(RTPpacketPtr, 2, &i_No_Of_Payloads);
@@ -127,7 +136,7 @@
/* Force update of SplitInfo if it's iLBC because of potential change between 20/30ms */
if (RTPpacket[i_k].payloadType == WebRtcNetEQ_DbGetPayload(&MCU_inst->codec_DB_inst,
- kDecoderILBC))
+ kDecoderILBC) && !is_sync_rtp) /* Don't update if sync RTP. */
{
i_ok = WebRtcNetEQ_DbGetSplitInfo(
&MCU_inst->PayloadSplit_inst,
@@ -175,6 +184,12 @@
if (RTPpacket[i_k].payloadType == WebRtcNetEQ_DbGetPayload(&MCU_inst->codec_DB_inst,
kDecoderAVT))
{
+ if (is_sync_rtp)
+ {
+ /* Sync RTP should not have AVT payload type. */
+ return RECIN_SYNC_RTP_NOT_ACCEPTABLE;
+ }
+
#ifdef NETEQ_ATEVENT_DECODE
if (MCU_inst->AVT_PlayoutOn)
{
@@ -205,6 +220,11 @@
/* Get CNG sample rate */
uint16_t fsCng = WebRtcNetEQ_DbGetSampleRate(&MCU_inst->codec_DB_inst,
RTPpacket[i_k].payloadType);
+ if (is_sync_rtp)
+ {
+ /* Sync RTP should not have CNG payload type. */
+ return RECIN_SYNC_RTP_NOT_ACCEPTABLE;
+ }
/* Force sampling frequency to 32000 Hz CNG 48000 Hz. */
/* TODO(tlegrand): remove limitation once ACM has full 48 kHz
@@ -245,6 +265,11 @@
{
return RECIN_UNKNOWNPAYLOAD;
}
+ if (is_sync_rtp)
+ {
+ /* Sync RTP should not cause codec change. */
+ return RECIN_SYNC_RTP_CHANGED_CODEC;
+ }
MCU_inst->current_Codec = curr_Codec;
MCU_inst->current_Payload = RTPpacket[i_k].payloadType;
i_ok = WebRtcNetEQ_DbGetSplitInfo(&MCU_inst->PayloadSplit_inst,
@@ -280,10 +305,11 @@
}
/*
- * Update Bandwidth Estimate
- * Only send the main payload to BWE
+ * If not sync RTP, update Bandwidth Estimate.
+ * Only send the main payload to BWE.
*/
- if ((curr_Codec = WebRtcNetEQ_DbGetCodec(&MCU_inst->codec_DB_inst,
+ if (!is_sync_rtp &&
+ (curr_Codec = WebRtcNetEQ_DbGetCodec(&MCU_inst->codec_DB_inst,
RTPpacket[0].payloadType)) >= 0)
{
codecPos = MCU_inst->codec_DB_inst.position[curr_Codec];