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:
@@ -419,8 +419,14 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
|
||||
total_bytes_to_process--;
|
||||
}
|
||||
|
||||
size_t numSamples = total_bytes_to_process / sizeof(int16_t);
|
||||
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);
|
||||
|
||||
@@ -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 */
|
||||
cBuffer->insert(cBuffer->end(), inputData, inputData + numSamples);
|
||||
|
||||
if (0 == d->reads++) {
|
||||
fireEvent = true;
|
||||
}
|
||||
switch_mutex_unlock(d->mutex);
|
||||
}
|
||||
if (fireEvent && d->session_id) {
|
||||
|
||||
Reference in New Issue
Block a user