diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-11-01 18:48:05 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-11-01 18:48:05 +0000 |
commit | 911461e2db8651d93f791a052e14eaf7e2258193 (patch) | |
tree | 6a822269f0bf5c01af62a8fc1d0a5686a0c55c27 | |
parent | cd7ee5f7cd6d49a4ed351fa7df55c2ca3289de89 (diff) |
use a writeable frame (some channel drivers/transcoders may modify the frame after it has been passed to ast_write())
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6926 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | channel.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -3933,19 +3933,19 @@ static void silence_generator_release(struct ast_channel *chan, void *data) /* nothing to do */ } -static short normal_silence_buf[160] = { 0, }; -static struct ast_frame normal_silence_frame = { - .frametype = AST_FRAME_VOICE, - .subclass = AST_FORMAT_SLINEAR, - .data = normal_silence_buf, - .samples = 160, - .datalen = sizeof(normal_silence_buf), -}; - static int silence_generator_generate(struct ast_channel *chan, void *data, int len, int samples) { if (samples == 160) { - if (ast_write(chan, &normal_silence_frame)) + short buf[160] = { 0, }; + struct ast_frame frame = { + .frametype = AST_FRAME_VOICE, + .subclass = AST_FORMAT_SLINEAR, + .data = buf, + .samples = 160, + .datalen = sizeof(buf), + }; + + if (ast_write(chan, &frame)) return -1; } else { short buf[samples]; @@ -3953,7 +3953,7 @@ static int silence_generator_generate(struct ast_channel *chan, void *data, int struct ast_frame frame = { .frametype = AST_FRAME_VOICE, .subclass = AST_FORMAT_SLINEAR, - .data = normal_silence_buf, + .data = buf, .samples = samples, .datalen = sizeof(buf), }; |