diff --git a/sflphone-common/src/audio/audiorecord.cpp b/sflphone-common/src/audio/audiorecord.cpp index 4cc6d1779432412c61772a0a785dc5bfda8c8fcb..125339fe8c0f9e0a5187cc7b863f025b1ca310a7 100644 --- a/sflphone-common/src/audio/audiorecord.cpp +++ b/sflphone-common/src/audio/audiorecord.cpp @@ -120,8 +120,6 @@ void AudioRecord::initFileName (std::string peerNumber) void AudioRecord::openFile() { - _info ("AudioRecord: Open file()"); - bool result = false; _debug ("AudioRecord: Open file()"); @@ -408,6 +406,8 @@ void AudioRecord::closeWavFile() return; } + _debug("AudioRecord: Close wave file"); + SINT32 bytes = byteCounter_ * channels_; @@ -473,6 +473,8 @@ void AudioRecord::recData (SFLDataFormat* buffer, int nSamples) if (recordingEnabled_) { + _debug("Recording enabled"); + if (fp == 0) { _debug ("AudioRecord: Can't record data, a file has not yet been opened!"); return; @@ -486,6 +488,7 @@ void AudioRecord::recData (SFLDataFormat* buffer, int nSamples) else { fflush (fp); byteCounter_ += (unsigned long) (nSamples*sizeof (SFLDataFormat)); + _debug("AudioRecord: wrote %d bytes", byteCounter_); } } } @@ -499,6 +502,8 @@ void AudioRecord::recData (SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int if (recordingEnabled_) { + _debug("Recording enabled"); + if (fp == 0) { _debug ("AudioRecord: Can't record data, a file has not yet been opened!"); return; diff --git a/sflphone-common/src/audio/audiorecorder.cpp b/sflphone-common/src/audio/audiorecorder.cpp index 99f4efaef07ec21e1fca3adb66dc2b5ba262b4a2..420572729a08895af497e7f0d4841854a67a9ab9 100644 --- a/sflphone-common/src/audio/audiorecorder.cpp +++ b/sflphone-common/src/audio/audiorecorder.cpp @@ -57,13 +57,18 @@ void AudioRecorder::run (void) _debug("Audiorecord: avail for get (before) %d", availBytes); - mbuffer->getData(buffer, availBytes, 100, recorderId); + if(availBytes > 0) { - availBytes = mbuffer->availForGet(recorderId); + int got = mbuffer->getData(buffer, availBytes, 100, recorderId); - _debug("Audiorecord: avail for get (after) %d", availBytes); + _debug("Audiorecord: audio get from main buffer %d", got); - // arecord->recData(buffer, availBytes/sizeof(SFLDataFormat)); + int availBytesAfter = mbuffer->availForGet(recorderId); + + _debug("Audiorecord: avail for get (after) %d", availBytesAfter); + + arecord->recData(buffer, availBytes/sizeof(SFLDataFormat)); + } sleep(20); diff --git a/sflphone-common/src/audio/audiortp/AudioRtpSession.h b/sflphone-common/src/audio/audiortp/AudioRtpSession.h index 07ff2dd7869484f91cfaa1595a79328d11e763a2..5144d3767989d019316a1837aaaa0c0c2f189e3b 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpSession.h +++ b/sflphone-common/src/audio/audiortp/AudioRtpSession.h @@ -736,10 +736,10 @@ namespace sfl { // DTMF over RTP, size must be over 4 in order to process it as voice data if(size > 4) { - // processDataDecode(spkrDataIn, size); - if(result == JB_OK) { - processDataDecode((unsigned char *)(frame.data), 160); - } + processDataDecode(spkrDataIn, size); + //if(result == JB_OK) { + // processDataDecode((unsigned char *)(frame.data), 160); + //} } delete adu; diff --git a/sflphone-common/src/audio/dcblocker.cpp b/sflphone-common/src/audio/dcblocker.cpp index bef34f6a510d4064bbe8020800a4ee61c8dcabfb..b1a18eb1a2e6ddcf97568825cd057df55a8b42fc 100644 --- a/sflphone-common/src/audio/dcblocker.cpp +++ b/sflphone-common/src/audio/dcblocker.cpp @@ -54,7 +54,7 @@ void DcBlocker::process (SFLDataFormat *data, int nbBytes) for (int i = 0; i < nbSamples; i++) { _x = data[i]; - _y = (SFLDataFormat) ( (float) _x - (float) _xm1 + 0.9999 * (float) _ym1); + _y = (SFLDataFormat) ( (float) _x - (float) _xm1 + 0.995 * (float) _ym1); _xm1 = _x; _ym1 = _y; diff --git a/sflphone-common/src/call.cpp b/sflphone-common/src/call.cpp index 0185cf681741319de89ff2ca4ee89aa33c8f9867..c640ad77b80d9e49f999cf2d142a21e8aadb9433 100644 --- a/sflphone-common/src/call.cpp +++ b/sflphone-common/src/call.cpp @@ -189,18 +189,33 @@ Call::isAudioStarted() bool Call::setRecording() { - bool recordStatus = Recordable::recAudio.setRecording(); + bool recordStatus = Recordable::recAudio.isRecording(); - if(!recordStatus) - return false; + Recordable::recAudio.setRecording(); - MainBuffer *mbuffer = Manager::instance().getMainBuffer(); + // Start recording + if(!recordStatus) { - CallID process_id = Recordable::recorder.getRecorderID(); + MainBuffer *mbuffer = Manager::instance().getMainBuffer(); + CallID process_id = Recordable::recorder.getRecorderID(); + + mbuffer->bindHalfDuplexOut(process_id, _id); + mbuffer->bindHalfDuplexOut(process_id); + + } + // Stop recording + else { + + MainBuffer *mbuffer = Manager::instance().getMainBuffer(); + CallID process_id = Recordable::recorder.getRecorderID(); + + mbuffer->unBindHalfDuplexOut(process_id, _id); + mbuffer->unBindHalfDuplexOut(process_id); + + } + + Manager::instance().getMainBuffer()->stateInfo(); - mbuffer->bindHalfDuplexOut(process_id, _id); - mbuffer->bindHalfDuplexOut(process_id); - Recordable::recorder.start(); return recordStatus;