diff options
author | Joshua Colp <jcolp@digium.com> | 2017-04-26 10:38:31 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2017-04-26 11:34:59 -0500 |
commit | 985a5fd7aac7a39cf9f9502f9e8e06ef216e1d35 (patch) | |
tree | f269c0f661d57bf412ac5d78e8669d77a7638f4a /main/audiohook.c | |
parent | e478d2eb94ec98ad8004e1b4b634b53e70591f8d (diff) |
frame: Better handle interpolated frames.
Interpolated frames are frames which contain a number of
samples but have no actual data. Audiohooks did not
handle this case when translating an incoming frame into
signed linear. It assumed that a frame would always contain
media when it may not. If this occurs audiohooks will now
immediately return and not act on the frame.
As well for users of ast_trans_frameout the function has
been changed to be a bit more sane and ensure that the data
pointer on a frame is set to NULL if no data is actually
on the frame. This allows the various spots in Asterisk that
check for an interpolated frame based on the presence of a
data pointer to work as expected.
ASTERISK-26926
Change-Id: I7fa22f631fa28d540722ed789ce28e84c7f8662b
Diffstat (limited to 'main/audiohook.c')
-rw-r--r-- | main/audiohook.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/main/audiohook.c b/main/audiohook.c index 986f11f84..2cba2de6e 100644 --- a/main/audiohook.c +++ b/main/audiohook.c @@ -945,6 +945,15 @@ static struct ast_frame *audio_audiohook_write_list(struct ast_channel *chan, st if (!(middle_frame = audiohook_list_translate_to_slin(audiohook_list, direction, start_frame))) { return frame; } + + /* If the translation resulted in an interpolated frame then immediately return as audiohooks + * rely on actual media being present to do things. + */ + if (!middle_frame->data.ptr) { + ast_frfree(middle_frame); + return start_frame; + } + samples = middle_frame->samples; /* |