[Asterisk-code-review] format wav: Read 16khz WAV samples properly (asterisk[13])
Sean Bright
asteriskteam at digium.com
Fri Apr 14 13:55:51 CDT 2017
Sean Bright has uploaded a new change for review. ( https://gerrit.asterisk.org/5478 )
Change subject: format_wav: Read 16khz WAV samples properly
......................................................................
format_wav: Read 16khz WAV samples properly
When opening a 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/78/5478/1
diff --git a/formats/format_wav.c b/formats/format_wav.c
index 42a27e4..fe499ac 100644
--- a/formats/format_wav.c
+++ b/formats/format_wav.c
@@ -325,9 +325,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/5478
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I05f8b263058dc573ea8ffe0c62e7964506e11815
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
More information about the asterisk-code-review
mailing list