summaryrefslogtreecommitdiff
path: root/cdr
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-07-22 07:16:40 -0300
committerJoshua Colp <jcolp@digium.com>2015-07-22 07:26:27 -0300
commitf1493f900e76304ecf28eed30d37fba8e54d926b (patch)
treecec2f94064cfd942e333cefe4cc097a5d7bee316 /cdr
parentd16347f33b04ee449481f00189cc6b432e9da682 (diff)
audiohook: Read the correct number of samples based on audiohook format.
Due to changes in audiohooks to support different sample rates the underlying storage of samples is in the format of the audiohook itself and not of the format being requested. This means that if a channel is using G722 the samples stored will be at 16kHz. If something subsequently reads from the audiohook at a format which is not the same sample rate as the audiohook the number of samples needs to be adjusted. Given the following example: 1. Channel writing into audiohook at 16kHz (as it is using G722). 2. Chanspy reading from audiohook at 8kHz. The original code would read 160 samples from the audiohook for each 20ms of audio. This is incorrect. Since the audio in the audiohook is at 16kHz the actual number needing to be read is 320. Failure to read this much would cause the audiohook to reset itself constantly as the buffer became full. This change adjusts the requested number of samples by determining the duration of audio requested and then calculating how many samples that would be in the audiohook format. ASTERISK-25247 #close Change-Id: Ia91ce516121882387a315fd8ee116b118b90653d
Diffstat (limited to 'cdr')
0 files changed, 0 insertions, 0 deletions