From 3942f3a985d2f51cd7fcefc9006e62b4b679601d Mon Sep 17 00:00:00 2001 From: "turaj@webrtc.org" Date: Tue, 4 Jun 2013 21:31:22 +0000 Subject: [PATCH] Issue 1847, memcopy is wrong and unnecessary, it is sufficient to store the pointer before clearing the instance, and write back the pointer. bug=issue1847 R=tina.legrand@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1585006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4178 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/audio_coding/neteq/dsp.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/webrtc/modules/audio_coding/neteq/dsp.c b/webrtc/modules/audio_coding/neteq/dsp.c index 4153d06880..ea2fa87d50 100644 --- a/webrtc/modules/audio_coding/neteq/dsp.c +++ b/webrtc/modules/audio_coding/neteq/dsp.c @@ -200,17 +200,12 @@ int WebRtcNetEQ_DSPInit(DSPInst_t *inst, uint16_t fs) int16_t saveMsPerCall = inst->millisecondsPerCall; enum BGNMode saveBgnMode = inst->BGNInst.bgnMode; #ifdef NETEQ_STEREO - MasterSlaveInfo saveMSinfo; + MasterSlaveInfo* saveMSinfo = inst->msInfo; #endif /* copy contents of statInst to avoid clearing */WEBRTC_SPL_MEMCPY_W16(&saveStats, &(inst->statInst), sizeof(DSPStats_t)/sizeof(int16_t)); -#ifdef NETEQ_STEREO - /* copy contents of msInfo to avoid clearing */WEBRTC_SPL_MEMCPY_W16(&saveMSinfo, &(inst->msInfo), - sizeof(MasterSlaveInfo)/sizeof(int16_t)); -#endif - /* check that the sample rate is valid */ if ((fs != 8000) #ifdef NETEQ_WIDEBAND @@ -292,8 +287,8 @@ int WebRtcNetEQ_DSPInit(DSPInst_t *inst, uint16_t fs) sizeof(DSPStats_t)/sizeof(int16_t)); #ifdef NETEQ_STEREO - /* Recreate MSinfo */WEBRTC_SPL_MEMCPY_W16(&(inst->msInfo), &saveMSinfo, - sizeof(MasterSlaveInfo)/sizeof(int16_t)); + /* Write back the pointer. */ + inst->msInfo = saveMSinfo; #endif #ifdef NETEQ_CNG_CODEC