Commit 6951abab authored by Alexandre Savard's avatar Alexandre Savard
Browse files

Audio record 2 buffers in sip

parent e9bb450d
...@@ -425,6 +425,8 @@ AudioRtpRTX::run () { ...@@ -425,6 +425,8 @@ AudioRtpRTX::run () {
initBuffers(); initBuffers();
int step; int step;
int sessionWaiting;
//try { //try {
// Init the session // Init the session
initAudioRtpSession(); initAudioRtpSession();
...@@ -455,6 +457,9 @@ AudioRtpRTX::run () { ...@@ -455,6 +457,9 @@ AudioRtpRTX::run () {
//////////////////////////// ////////////////////////////
// Send session // Send session
//////////////////////////// ////////////////////////////
sessionWaiting = _session->isWaiting();
sendSessionFromMic(timestamp); sendSessionFromMic(timestamp);
timestamp += step; timestamp += step;
...@@ -465,10 +470,15 @@ AudioRtpRTX::run () { ...@@ -465,10 +470,15 @@ AudioRtpRTX::run () {
// Let's wait for the next transmit cycle // Let's wait for the next transmit cycle
if(_session->isWaiting())
if(sessionWaiting == 1){
_debug("Record TWO buffer \n");
_ca->recAudio.recData(spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic); _ca->recAudio.recData(spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic);
else }
else {
_debug("Record ONE buffer \n");
_ca->recAudio.recData(micData,_nSamplesMic); _ca->recAudio.recData(micData,_nSamplesMic);
}
Thread::sleep(TimerPort::getTimer()); Thread::sleep(TimerPort::getTimer());
TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms
......
...@@ -460,8 +460,8 @@ void AudioRecord::recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int ...@@ -460,8 +460,8 @@ void AudioRecord::recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int
if ( sndFormat_ == INT16 ) { // TODO change INT16 to SINT16 if ( sndFormat_ == INT16 ) { // TODO change INT16 to SINT16
for (int k=0; k<nSamples_1; k++){ for (int k=0; k<nSamples_1; k++){
// mixBuffer_[k] = ((buffer_1[k]+buffer_2[k])/2)/32767;
mixBuffer_[k] = (buffer_1[k]+buffer_2[k]); mixBuffer_[k] = (buffer_1[k]+buffer_2[k]);
// dsp.getRMS(mixBuffer_[k]); // dsp.getRMS(mixBuffer_[k]);
if ( fwrite(&buffer_1[k], 2, 1, fp) != 1) if ( fwrite(&buffer_1[k], 2, 1, fp) != 1)
......
Supports Markdown
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