From 3f5a3720590b3003946616938ea142bfd4568165 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.com> Date: Mon, 23 Aug 2010 09:59:25 -0400 Subject: [PATCH] [#3904] Fix memmory corruption in delaydetection --- sflphone-common/src/audio/alsa/alsalayer.cpp | 13 +++++++------ .../src/audio/pulseaudio/audiostream.cpp | 18 +++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sflphone-common/src/audio/alsa/alsalayer.cpp b/sflphone-common/src/audio/alsa/alsalayer.cpp index 55c018824c..16c68a581d 100644 --- a/sflphone-common/src/audio/alsa/alsalayer.cpp +++ b/sflphone-common/src/audio/alsa/alsalayer.cpp @@ -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); } diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp index 2372921465..5cffbbe490 100644 --- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp +++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp @@ -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); -- GitLab