mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
Add "prod" function, to get audio moving
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@856 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
13
channel.c
13
channel.c
@@ -726,6 +726,7 @@ int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen,
|
||||
chan->generator->release(chan, chan->generatordata);
|
||||
chan->generatordata = NULL;
|
||||
}
|
||||
ast_prod(chan);
|
||||
if ((chan->generatordata = gen->alloc(chan, params))) {
|
||||
chan->generator = gen;
|
||||
} else {
|
||||
@@ -1210,6 +1211,18 @@ static int do_senddigit(struct ast_channel *chan, char digit)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_prod(struct ast_channel *chan)
|
||||
{
|
||||
struct ast_frame a = { AST_FRAME_VOICE };
|
||||
char nothing[128];
|
||||
/* Send an empty audio frame to get things moving */
|
||||
if (chan->_state != AST_STATE_UP) {
|
||||
a.subclass = chan->pvt->rawwriteformat;
|
||||
a.data = nothing + AST_FRIENDLY_OFFSET;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_write(struct ast_channel *chan, struct ast_frame *fr)
|
||||
{
|
||||
int res = -1;
|
||||
|
@@ -462,6 +462,9 @@ struct ast_frame *ast_read(struct ast_channel *chan);
|
||||
*/
|
||||
int ast_write(struct ast_channel *chan, struct ast_frame *frame);
|
||||
|
||||
/* Send empty audio to prime a channel driver */
|
||||
int ast_prod(struct ast_channel *chan);
|
||||
|
||||
//! Sets read format on channel chan
|
||||
/*!
|
||||
* \param chan channel to change
|
||||
|
Reference in New Issue
Block a user