summaryrefslogtreecommitdiff
path: root/formats/format_sln.c
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2018-04-18 15:59:38 -0500
committerKevin Harwell <kharwell@digium.com>2018-04-24 14:54:25 -0600
commitff652711c7eaf6e78fd7b201099de90558d79a9d (patch)
tree8e6f4fd109dec9cee587d04385ba5ccb0bcbbd92 /formats/format_sln.c
parenta9c74fdc0462349bd9ae6f25ae72f071c95d1e76 (diff)
translate: generic plc not filled in after translation
If during translation a codec could not handle a given frame the translation core would return NULL, thus not passing along the "missing" frame. Due to this there was no frame to apply generic plc to, thus rendering it useless. This patch makes it so the translation core produces an interpolated slin frame in the cases where an attempt was made to translate to slin, but failed. This interpolated frame is then passed along and can be used by the generic plc algorithms to fill in the frame. ASTERISK-27814 #close Change-Id: I133d084da87adef913bf2ecc9c9240e3eaf4f40a
Diffstat (limited to 'formats/format_sln.c')
-rw-r--r--formats/format_sln.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/formats/format_sln.c b/formats/format_sln.c
index 6ad8c386e..80d348400 100644
--- a/formats/format_sln.c
+++ b/formats/format_sln.c
@@ -54,6 +54,12 @@ static struct ast_frame *generic_read(struct ast_filestream *s, int *whennext, u
static int slinear_write(struct ast_filestream *fs, struct ast_frame *f)
{
int res;
+
+ /* Don't try to write an interpolated frame */
+ if (f->datalen == 0) {
+ return 0;
+ }
+
if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
ast_log(LOG_WARNING, "Bad write (%d/%d): %s\n", res, f->datalen, strerror(errno));
return -1;