mirror of
https://github.com/jambonz/freeswitch-modules.git
synced 2026-01-25 02:08:27 +00:00
remove deepgram tts linear16 wav 44 bytes header (#34)
* remove deepgram tts linear16 wav 44 bytes header Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com> * wip Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com> --------- Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com>
This commit is contained in:
1 parent
8e7f4a3fab
commit
d05cfb8ef0
1 file changed
+7
-4
@@ -419,8 +419,14 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
|
|||||||
total_bytes_to_process--;
|
total_bytes_to_process--;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t numSamples = total_bytes_to_process / sizeof(int16_t);
|
|
||||||
int16_t* inputData = reinterpret_cast<int16_t*>(data);
|
int16_t* inputData = reinterpret_cast<int16_t*>(data);
|
||||||
|
if (0 == d->reads++) {
|
||||||
|
fireEvent = true;
|
||||||
|
// Deepgram return PCM linear16 WAV file which contains 44 bytes headers, remove that.
|
||||||
|
inputData += 22;
|
||||||
|
total_bytes_to_process -= 44;
|
||||||
|
}
|
||||||
|
size_t numSamples = total_bytes_to_process / sizeof(int16_t);
|
||||||
{
|
{
|
||||||
switch_mutex_lock(d->mutex);
|
switch_mutex_lock(d->mutex);
|
||||||
|
|
||||||
@@ -446,9 +452,6 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
|
|||||||
/* Push the data into the buffer */
|
/* Push the data into the buffer */
|
||||||
cBuffer->insert(cBuffer->end(), inputData, inputData + numSamples);
|
cBuffer->insert(cBuffer->end(), inputData, inputData + numSamples);
|
||||||
|
|
||||||
if (0 == d->reads++) {
|
|
||||||
fireEvent = true;
|
|
||||||
}
|
|
||||||
switch_mutex_unlock(d->mutex);
|
switch_mutex_unlock(d->mutex);
|
||||||
}
|
}
|
||||||
if (fireEvent && d->session_id) {
|
if (fireEvent && d->session_id) {
|
||||||
|
|||||||
Reference in new issue
Block a user