mirror of
https://github.com/jambonz/freeswitch-modules.git
synced 2025-12-19 08:57:44 +00:00
initialize variables to avoid possible junk values
Signed-off-by: Dave Horton <daveh@beachdognet.com>
This commit is contained in:
@@ -764,7 +764,9 @@ extern "C" {
|
|||||||
conn->file = d->file;
|
conn->file = d->file;
|
||||||
conn->body = json;
|
conn->body = json;
|
||||||
conn->flushed = false;
|
conn->flushed = false;
|
||||||
|
conn->has_last_byte = false;
|
||||||
|
conn->last_byte = 0;
|
||||||
|
|
||||||
|
|
||||||
d->circularBuffer = (void *) new CircularBuffer_t(BUFFER_GROW_SIZE);
|
d->circularBuffer = (void *) new CircularBuffer_t(BUFFER_GROW_SIZE);
|
||||||
// Always use deepgram at rate 8000 for helping cache audio from jambonz.
|
// Always use deepgram at rate 8000 for helping cache audio from jambonz.
|
||||||
|
|||||||
@@ -394,6 +394,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
|
|||||||
std::unique_ptr<uint8_t[]> combinedData;
|
std::unique_ptr<uint8_t[]> combinedData;
|
||||||
|
|
||||||
if (conn->has_last_byte) {
|
if (conn->has_last_byte) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "rimelabs write_cb: processing last byte from previous read\n");
|
||||||
|
|
||||||
conn->has_last_byte = false; // We'll handle the last_byte now, so toggle the flag off
|
conn->has_last_byte = false; // We'll handle the last_byte now, so toggle the flag off
|
||||||
|
|
||||||
// Allocate memory for the new data array
|
// Allocate memory for the new data array
|
||||||
@@ -415,6 +417,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
|
|||||||
|
|
||||||
// If we now have an odd total, save the last byte for next time
|
// If we now have an odd total, save the last byte for next time
|
||||||
if ((total_bytes_to_process % sizeof(int16_t)) != 0) {
|
if ((total_bytes_to_process % sizeof(int16_t)) != 0) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "rimelabs write_cb: got odd number of bytes %d\n", total_bytes_to_process);
|
||||||
|
|
||||||
conn->last_byte = data[total_bytes_to_process - 1];
|
conn->last_byte = data[total_bytes_to_process - 1];
|
||||||
conn->has_last_byte = true;
|
conn->has_last_byte = true;
|
||||||
total_bytes_to_process--;
|
total_bytes_to_process--;
|
||||||
@@ -758,6 +762,8 @@ extern "C" {
|
|||||||
conn->file = d->file;
|
conn->file = d->file;
|
||||||
conn->body = json;
|
conn->body = json;
|
||||||
conn->flushed = false;
|
conn->flushed = false;
|
||||||
|
conn->has_last_byte = false;
|
||||||
|
conn->last_byte = 0;
|
||||||
|
|
||||||
|
|
||||||
d->circularBuffer = (void *) new CircularBuffer_t(BUFFER_GROW_SIZE);
|
d->circularBuffer = (void *) new CircularBuffer_t(BUFFER_GROW_SIZE);
|
||||||
|
|||||||
Reference in New Issue
Block a user