[Asterisk-code-review] format wav: Read 16khz wav samples properly (asterisk[master])
Sean Bright
asteriskteam at digium.com
Fri Apr 14 13:57:08 CDT 2017
Sean Bright has uploaded a new change for review. ( https://gerrit.asterisk.org/5480 )
Change subject: format_wav: Read 16khz wav samples properly
......................................................................
format_wav: Read 16khz wav samples properly
When opening a PCM wave file for reading, we aren't tracking the
frequency of the opened file, so we treat 16khz files as 8khz and do
half reads.
ASTERISK-26613 #close
Reported by: Vitaly K
Change-Id: I05f8b263058dc573ea8ffe0c62e7964506e11815
---
M formats/format_wav.c
1 file changed, 8 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/80/5480/1
diff --git a/formats/format_wav.c b/formats/format_wav.c
index 049ead4..cb9b10b 100644
--- a/formats/format_wav.c
+++ b/formats/format_wav.c
@@ -323,9 +323,15 @@
/* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check
and be sure it's a valid file. */
- struct wav_desc *tmp = (struct wav_desc *)s->_private;
- if ((tmp->maxlen = check_header(s->f, ast_format_get_sample_rate(s->fmt->format))) < 0)
+ struct wav_desc *tmp = s->_private;
+ unsigned int sample_rate = ast_format_get_sample_rate(s->fmt->format);
+
+ tmp->maxlen = check_header(s->f, sample_rate);
+ if (tmp->maxlen < 0) {
return -1;
+ }
+
+ tmp->hz = sample_rate;
return 0;
}
--
To view, visit https://gerrit.asterisk.org/5480
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I05f8b263058dc573ea8ffe0c62e7964506e11815
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
More information about the asterisk-code-review
mailing list