When reading codec2 data, pad out to a multiple of 8 bytes with 0s so that when frames are pushed from the buffer, we don't get garbage at the ends of prompts which are not an exact multiple of 8 bytes.
This commit is contained in:
parent
69b023dd4a
commit
befc892068
|
|
@ -154,6 +154,13 @@ static void GetCodec2Data(int offset, int length)
|
||||||
|
|
||||||
fseek(voice_prompt_file, vpDataOffset+offset, SEEK_SET);
|
fseek(voice_prompt_file, vpDataOffset+offset, SEEK_SET);
|
||||||
fread((void*)&Codec2Data, length, 1, voice_prompt_file);
|
fread((void*)&Codec2Data, length, 1, voice_prompt_file);
|
||||||
|
// zero buffer from length to the next multiple of 8 to avoid garbage
|
||||||
|
// being played back, since codec2 frames are pushed in lots of 8 bytes.
|
||||||
|
if ((length % 8) != 0)
|
||||||
|
{
|
||||||
|
int bytesToZero = length % 8;
|
||||||
|
memset(Codec2Data+length, 0, bytesToZero);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vpTerminate(void)
|
void vpTerminate(void)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue