mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-23 13:09:00 +00:00
use a writeable frame (some channel drivers/transcoders may modify the frame after it has been passed to ast_write())
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6926 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
22
channel.c
22
channel.c
@@ -3933,19 +3933,19 @@ static void silence_generator_release(struct ast_channel *chan, void *data)
|
|||||||
/* nothing to do */
|
/* 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)
|
static int silence_generator_generate(struct ast_channel *chan, void *data, int len, int samples)
|
||||||
{
|
{
|
||||||
if (samples == 160) {
|
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;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
short buf[samples];
|
short buf[samples];
|
||||||
@@ -3953,7 +3953,7 @@ static int silence_generator_generate(struct ast_channel *chan, void *data, int
|
|||||||
struct ast_frame frame = {
|
struct ast_frame frame = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_SLINEAR,
|
.subclass = AST_FORMAT_SLINEAR,
|
||||||
.data = normal_silence_buf,
|
.data = buf,
|
||||||
.samples = samples,
|
.samples = samples,
|
||||||
.datalen = sizeof(buf),
|
.datalen = sizeof(buf),
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user