Commit 8735167e authored by Alexandre Savard's avatar Alexandre Savard

[#2165] Fix intermitent recording

parent b021cff0
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
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