From e20b9edb5738fa665fb4b639d5303ad2ff180208 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Wed, 24 Oct 2012 16:54:33 -0400 Subject: [PATCH] Bug 803881: Fix wrong number of samples for webrtc media unit tests r=ekr --- media/webrtc/signaling/test/mediaconduit_unittests.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/media/webrtc/signaling/test/mediaconduit_unittests.cpp b/media/webrtc/signaling/test/mediaconduit_unittests.cpp index 029097ec261..2a200911201 100644 --- a/media/webrtc/signaling/test/mediaconduit_unittests.cpp +++ b/media/webrtc/signaling/test/mediaconduit_unittests.cpp @@ -270,13 +270,14 @@ void AudioSendAndReceive::GenerateAndReadSamples() int16_t audioOutput[PLAYOUT_SAMPLE_LENGTH]; short* inbuf; int sampleLengthDecoded = 0; - int SAMPLES = PLAYOUT_SAMPLE_FREQUENCY * 10; //10 milliseconds + int SAMPLES = (PLAYOUT_SAMPLE_FREQUENCY * 10)/1000; //10 milliseconds int CHANNELS = 1; //mono audio - int sampleLengthInBytes = PLAYOUT_SAMPLE_LENGTH * sizeof(short); + int sampleLengthInBytes = sizeof(audioInput); //generated audio buffer inbuf = (short *)moz_xmalloc(sizeof(short)*SAMPLES*CHANNELS); memset(audioInput,0,sampleLengthInBytes); memset(audioOutput,0,sampleLengthInBytes); + MOZ_ASSERT(SAMPLES <= PLAYOUT_SAMPLE_LENGTH); FILE* inFile = fopen( iFile.c_str(), "wb+"); if(!inFile) {