Commit 173e48c3 authored by Alexandre Savard's avatar Alexandre Savard

[#2209] Clean up debug messages

parent 7bcb3527
......@@ -778,7 +778,6 @@ void AlsaLayer::audioCallback (void)
} else {
_debug("AlsaLayer::writeToSpeaker\n");
// If nothing urgent, play the regular sound samples
......@@ -791,12 +790,8 @@ void AlsaLayer::audioCallback (void)
double upsampleFactor = (double) _audioSampleRate / _mainBufferSampleRate;
_debug(" upsampleFactor: %f\n", upsampleFactor);
_debug(" toGet: %i\n", toGet);
maxNbSamplesToGet = (int) ((double) framesPerBufferAlsa / upsampleFactor);
_debug(" maxNbFrames: %i\n", maxNbSamplesToGet);
} else {
......@@ -817,25 +812,20 @@ void AlsaLayer::audioCallback (void)
if (_mainBufferSampleRate && ((int)_audioSampleRate != _mainBufferSampleRate)) {
_debug(" malloc in byte: %i\n", maxNbBytesToGet);
rsmpl_out = (SFLDataFormat*) malloc (framesPerBufferAlsa * sizeof (SFLDataFormat));
// Do sample rate conversion
int nb_sample_down = toGet / sizeof(SFLDataFormat);
_debug(" _audioSampleRate: %i\n", _audioSampleRate);
_debug(" _mainBufferSampleRate: %i\n", _mainBufferSampleRate);
_debug(" nbSample (before conversion): %i\n", nb_sample_down);
int nbSample = _converter->upsampleData((SFLDataFormat*)out, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_down);
_debug(" nbSample (after conversion): %i\n", nbSample);
write (rsmpl_out, nbSample*sizeof(SFLDataFormat));
free(rsmpl_out);
_debug(" successfull rsmpl_out free!\n");
rsmpl_out = 0;
} else {
......@@ -869,7 +859,7 @@ void AlsaLayer::audioCallback (void)
in = 0;
if(is_capture_running())
{
_debug("AlsaLayer::readFromMic\n");
micAvailBytes = snd_pcm_avail_update(_CaptureHandle);
if(micAvailBytes > 0)
......@@ -889,10 +879,6 @@ void AlsaLayer::audioCallback (void)
int nbSample = toPut / sizeof(SFLDataFormat);
int nb_sample_up = nbSample;
_debug(" _audioSampleRate: %i\n", _audioSampleRate);
_debug(" _mainBufferSampleRate: %i\n", _mainBufferSampleRate);
_debug(" nbSample (before conversion): %i\n", nbSample);
nbSample = _converter->downsampleData ((SFLDataFormat*)in, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_up);
_mainBuffer.putData(rsmpl_out, nbSample * sizeof (SFLDataFormat), 100);
......
......@@ -309,9 +309,6 @@ namespace sfl {
{
assert(_audiocodec);
assert(_audiolayer);
_debug("AudioRtpSession::processDataEncode\n");
int _mainBufferSampleRate = _audiolayer->getMainBuffer()->getInternalSamplingRate();
......@@ -325,9 +322,6 @@ namespace sfl {
// available bytes inside ringbuffer
int availBytesFromMic = _audiolayer->getMainBuffer()->availForGet(_ca->getCallId());
_debug(" availBytesFromMic: %i\n", availBytesFromMic);
_debug(" maxByesToGet: %i\n", maxBytesToGet);
// set available byte to maxByteToGet
int bytesAvail = (availBytesFromMic < maxBytesToGet) ? availBytesFromMic : maxBytesToGet;
......@@ -340,24 +334,17 @@ namespace sfl {
// nb bytes to be sent over RTP
int compSize = 0;
_debug(" _codecSampleRate: %i\n", _codecSampleRate);
_debug(" _mainBufferSampleRate: %i\n", _mainBufferSampleRate);
_debug(" nbSample (before conversion): %i\n", nbSample);
// test if resampling is required
if (_audiocodec->getClockRate() != _mainBufferSampleRate) {
int nb_sample_up = nbSample;
_nSamplesMic = nbSample;
nbSample = _converter->downsampleData (_micData , _micDataConverted , _audiocodec->getClockRate(), _mainBufferSampleRate, nb_sample_up);
_debug(" nbSample (after conversion): %i\n", nbSample);
compSize = _audiocodec->codecEncode (_micDataEncoded, _micDataConverted, nbSample*sizeof (int16));
} else {
// no resampling required
compSize = _audiocodec->codecEncode (_micDataEncoded, _micData, nbSample*sizeof (int16));
_debug(" compSize: %i\n", compSize);
}
return compSize;
......@@ -367,7 +354,6 @@ namespace sfl {
void AudioRtpSession<D>::processDataDecode(unsigned char * spkrData, unsigned int size, int& countTime)
{
_debug("AudioRtpSession::processDataDecode\n");
if (_audiocodec != NULL) {
int _mainBufferSampleRate = _audiolayer->getMainBuffer()->getInternalSamplingRate();
......@@ -378,10 +364,6 @@ namespace sfl {
// buffer _receiveDataDecoded ----> short int or int16, coded on 2 bytes
int nbSample = expandedSize / sizeof (SFLDataFormat);
_debug(" _codecSampleRate: %i\n", _codecSampleRate);
_debug(" _mainBufferSampleRate: %i\n", _mainBufferSampleRate);
_debug(" nbSample (before conversion): %i\n", nbSample);
// test if resampling is required
if (_audiocodec->getClockRate() != _mainBufferSampleRate) {
......@@ -390,8 +372,6 @@ namespace sfl {
nbSample = _converter->upsampleData (_spkrDataDecoded, _spkrDataConverted, _codecSampleRate, _mainBufferSampleRate, nb_sample_down);
_debug(" nbSample (after conversion): %i\n", nbSample);
// Store the number of samples for recording
_nSamplesSpkr = nbSample;
......
......@@ -360,8 +360,6 @@ void PulseLayer::writeToSpeaker (void)
SFLDataFormat* out;// = (SFLDataFormat*)pa_xmalloc(framesPerBuffer);
urgentAvailBytes = _urgentRingBuffer.AvailForGet();
_debug("PulseLayer::writeToSpeaker\n");
if (urgentAvailBytes > 0) {
// Urgent data (dtmf, incoming call signal) come first.
......@@ -421,9 +419,8 @@ void PulseLayer::writeToSpeaker (void)
out = (SFLDataFormat*) pa_xmalloc (maxNbBytesToGet);
normalAvailBytes = _mainBuffer.availForGet();
_debug(" normalAvail: %i\n", normalAvailBytes);
toGet = (normalAvailBytes < (int)(maxNbBytesToGet)) ? normalAvailBytes : maxNbBytesToGet;
_debug(" toGet: %i\n", toGet);
if (toGet) {
......@@ -437,14 +434,9 @@ void PulseLayer::writeToSpeaker (void)
// Do sample rate conversion
int nb_sample_down = toGet / sizeof(SFLDataFormat);
_debug(" _audioSampleRate: %i\n", _audioSampleRate);
_debug(" _mainBufferSampleRate: %i\n", _mainBufferSampleRate);
_debug(" nbSample (before conversion): %i\n", nb_sample_down);
int nbSample = _converter->upsampleData((SFLDataFormat*)out, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_down);
_debug(" nbSample (after conversion): %i\n", nbSample);
pa_stream_write (playback->pulseStream(), rsmpl_out, nbSample*sizeof(SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
pa_xfree (rsmpl_out);
......@@ -478,8 +470,6 @@ void PulseLayer::readFromMic (void)
//_debug("pa_stream_peek() failed: %s\n" , pa_strerror( pa_context_errno( context) ));
}
_debug("PulseLayer::readFromMic\n");
if (data != 0) {
int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate();
......@@ -488,19 +478,14 @@ void PulseLayer::readFromMic (void)
if (_mainBufferSampleRate && ((int)_audioSampleRate != _mainBufferSampleRate)) {
_debug(" framesPerBuffer: %i\n", framesPerBuffer);
SFLDataFormat* rsmpl_out = (SFLDataFormat*) pa_xmalloc (framesPerBuffer * sizeof (SFLDataFormat));
int nbSample = r / sizeof(SFLDataFormat);
int nb_sample_up = nbSample;
_debug(" _audioSampleRate: %i\n", _audioSampleRate);
_debug(" _mainBufferSampleRate: %i\n", _mainBufferSampleRate);
_debug(" nbSample (before conversion): %i\n", nbSample);
nbSample = _converter->downsampleData ((SFLDataFormat*)data, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_up);
_debug(" nbSample (after conversion): %i\n", nbSample);
_mainBuffer.putData ( (void*) rsmpl_out, nbSample*sizeof(SFLDataFormat), 100);
......
......@@ -116,13 +116,13 @@ int SamplerateConverter::upsampleData (SFLDataFormat* dataIn , SFLDataFormat* da
src_data.output_frames = (int) floor (upsampleFactor * nbSamples);
src_data.src_ratio = upsampleFactor;
src_data.end_of_input = 0; // More data will come
_debug(" upsample %d %d %f %d\n" , src_data.input_frames , src_data.output_frames, src_data.src_ratio , nbSamples);
// _debug(" upsample %d %d %f %d\n" , src_data.input_frames , src_data.output_frames, src_data.src_ratio , nbSamples);
// Override libsamplerate conversion function
Short2FloatArray (dataIn , _floatBufferDownSpkr, nbSamples);
//src_short_to_float_array (dataIn , _floatBufferDownSpkr, nbSamples);
//_debug("upsample %d %f %d\n" , src_data.output_frames, src_data.src_ratio , nbSamples);
src_process (_src_state_spkr, &src_data);
_debug(" upsample %d %d %d\n" , samplerate1, samplerate2 , nbSamples);
// _debug(" upsample %d %d %d\n" , samplerate1, samplerate2 , nbSamples);
nbSamples = (src_data.output_frames_gen > nbSamplesMax) ? nbSamplesMax : src_data.output_frames_gen;
src_float_to_short_array (_floatBufferUpSpkr, dataOut, nbSamples);
//_debug("upsample %d %d %d\n" , samplerate1, samplerate2 , nbSamples);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment