Skip to content
Snippets Groups Projects
Commit 3f5a3720 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3904] Fix memmory corruption in delaydetection

parent f0d5c382
No related branches found
No related tags found
No related merge requests found
......@@ -1024,7 +1024,7 @@ void AlsaLayer::audioCallback (void)
}
// Copy far-end signal in echo canceller to adapt filter coefficient
AudioLayer::_echoCanceller->putData (out, toGet);
// AudioLayer::_echoCanceller->putData (out, toGet);
} else {
......@@ -1122,10 +1122,10 @@ void AlsaLayer::audioCallback (void)
_audiofilter->processAudio (rsmpl_out, nbSample*sizeof (SFLDataFormat));
// echo cancellation processing
int sampleready = AudioLayer::_echoCanceller->processAudio (rsmpl_out, echoCancelledMic, nbSample*sizeof (SFLDataFormat));
// int sampleready = AudioLayer::_echoCanceller->processAudio (rsmpl_out, echoCancelledMic, nbSample*sizeof (SFLDataFormat));
// getMainBuffer()->putData (rsmpl_out, nbSample * sizeof (SFLDataFormat), 100);
getMainBuffer()->putData (echoCancelledMic, sampleready*sizeof (SFLDataFormat), 100);
getMainBuffer()->putData (rsmpl_out, nbSample * sizeof (SFLDataFormat), 100);
// getMainBuffer()->putData (echoCancelledMic, sampleready*sizeof (SFLDataFormat), 100);
free (rsmpl_out);
rsmpl_out = 0;
......@@ -1137,8 +1137,9 @@ void AlsaLayer::audioCallback (void)
if (filter_out) {
_audiofilter->processAudio (in, filter_out, toPut);
int sampleready = AudioLayer::_echoCanceller->processAudio (filter_out, echoCancelledMic, toPut);
getMainBuffer()->putData (echoCancelledMic, sampleready*sizeof (SFLDataFormat), 100);
// int sampleready = AudioLayer::_echoCanceller->processAudio (filter_out, echoCancelledMic, toPut);
// getMainBuffer()->putData (echoCancelledMic, sampleready*sizeof (SFLDataFormat), 100);
getMainBuffer()->putData (filter_out, toPut, 100);
free (filter_out);
}
......
......@@ -212,10 +212,10 @@ AudioStream::createStream (pa_context* c, std::string *deviceName)
if (_streamType == PLAYBACK_STREAM) {
attributes->maxlength = pa_usec_to_bytes (80 * PA_USEC_PER_MSEC, &_sample_spec); // -1;
attributes->tlength = pa_usec_to_bytes (40 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->maxlength = pa_usec_to_bytes (160 * PA_USEC_PER_MSEC, &_sample_spec); // -1;
attributes->tlength = pa_usec_to_bytes (80 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->prebuf = 0;
attributes->fragsize = pa_usec_to_bytes (20 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->fragsize = pa_usec_to_bytes (80 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->minreq = (uint32_t) -1;
pa_threaded_mainloop_lock (_mainloop);
......@@ -230,10 +230,10 @@ AudioStream::createStream (pa_context* c, std::string *deviceName)
} else if (_streamType == CAPTURE_STREAM) {
attributes->maxlength = pa_usec_to_bytes (80 * PA_USEC_PER_MSEC, &_sample_spec);// (uint32_t) -1;
attributes->tlength = pa_usec_to_bytes (40 * PA_USEC_PER_MSEC, &_sample_spec);// pa_usec_to_bytes (20 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->maxlength = pa_usec_to_bytes (160 * PA_USEC_PER_MSEC, &_sample_spec);// (uint32_t) -1;
attributes->tlength = pa_usec_to_bytes (80 * PA_USEC_PER_MSEC, &_sample_spec);// pa_usec_to_bytes (20 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->prebuf = 0;
attributes->fragsize = pa_usec_to_bytes (20 * PA_USEC_PER_MSEC, &_sample_spec); // pa_usec_to_bytes (20 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->fragsize = pa_usec_to_bytes (80 * PA_USEC_PER_MSEC, &_sample_spec); // pa_usec_to_bytes (20 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->minreq = (uint32_t) -1;
pa_threaded_mainloop_lock (_mainloop);
......@@ -248,10 +248,10 @@ AudioStream::createStream (pa_context* c, std::string *deviceName)
} else if (_streamType == RINGTONE_STREAM) {
attributes->maxlength = pa_usec_to_bytes (80 * PA_USEC_PER_MSEC, &_sample_spec);;
attributes->tlength = pa_usec_to_bytes (40 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->maxlength = pa_usec_to_bytes (160 * PA_USEC_PER_MSEC, &_sample_spec);;
attributes->tlength = pa_usec_to_bytes (80 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->prebuf = 0;
attributes->fragsize = pa_usec_to_bytes (20 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->fragsize = pa_usec_to_bytes (80 * PA_USEC_PER_MSEC, &_sample_spec);
attributes->minreq = (uint32_t) -1;
pa_threaded_mainloop_lock (_mainloop);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment