mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 03:02:15 +00:00
I thought I was going to be able to leave 1.4 alone, but that was not the case.
I ran into some problems with G.722 in 1.4, so I have merged in all of the fixes in this area that I have made in trunk/1.6.0, and things are happy again. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@114550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1573,7 +1573,7 @@ static int generator_force(const void *data)
|
||||
if (!tmp || !generate)
|
||||
return 0;
|
||||
|
||||
res = generate(chan, tmp, 0, 160);
|
||||
res = generate(chan, tmp, 0, ast_format_rate(chan->writeformat & AST_FORMAT_AUDIO_MASK) / 50);
|
||||
|
||||
chan->generatordata = tmp;
|
||||
|
||||
@@ -1889,6 +1889,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
|
||||
void *tmp = chan->generatordata;
|
||||
int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples) = NULL;
|
||||
int res;
|
||||
int samples;
|
||||
|
||||
if (chan->timingfunc) {
|
||||
if (option_debug > 1)
|
||||
@@ -1897,6 +1898,15 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
|
||||
}
|
||||
|
||||
chan->generatordata = NULL; /* reset, to let writes go through */
|
||||
|
||||
if (f->subclass != chan->writeformat) {
|
||||
float factor;
|
||||
factor = ((float) ast_format_rate(chan->writeformat)) / ((float) ast_format_rate(f->subclass));
|
||||
samples = (int) ( ((float) f->samples) * factor );
|
||||
} else {
|
||||
samples = f->samples;
|
||||
}
|
||||
|
||||
if (chan->generator->generate) {
|
||||
generate = chan->generator->generate;
|
||||
}
|
||||
@@ -1909,7 +1919,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
|
||||
* avoidance not to work in deeper functions
|
||||
*/
|
||||
ast_channel_unlock(chan);
|
||||
res = generate(chan, tmp, f->datalen, f->samples);
|
||||
res = generate(chan, tmp, f->datalen, samples);
|
||||
ast_channel_lock(chan);
|
||||
chan->generatordata = tmp;
|
||||
if (res) {
|
||||
|
Reference in New Issue
Block a user