Skip to content
Snippets Groups Projects
Commit 3ef3ad62 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2209] Fix iax low rate packate sending

parent 7df9911f
Branches
Tags
No related merge requests found
...@@ -326,7 +326,7 @@ IAXVoIPLink::sendAudioFromMic (void) ...@@ -326,7 +326,7 @@ IAXVoIPLink::sendAudioFromMic (void)
// we have to get 20ms of data from the mic *20/1000 = /50 // we have to get 20ms of data from the mic *20/1000 = /50
// rate/50 shall be lower than IAX__20S_48KHZ_MAX // rate/50 shall be lower than IAX__20S_48KHZ_MAX
maxBytesToGet = audiolayer->getSampleRate() * audiolayer->getFrameSize() / 1000 * sizeof (SFLDataFormat); maxBytesToGet = _mainBufferSampleRate * audiolayer->getFrameSize() / 1000 * sizeof (SFLDataFormat);
// available bytes inside ringbuffer // available bytes inside ringbuffer
availBytesFromMic = audiolayer->getMainBuffer()->availForGet(currentCall->getCallId()); availBytesFromMic = audiolayer->getMainBuffer()->availForGet(currentCall->getCallId());
...@@ -339,18 +339,14 @@ IAXVoIPLink::sendAudioFromMic (void) ...@@ -339,18 +339,14 @@ IAXVoIPLink::sendAudioFromMic (void)
// take the lowest // take the lowest
bytesAvail = (availBytesFromMic < maxBytesToGet) ? availBytesFromMic : maxBytesToGet; bytesAvail = (availBytesFromMic < maxBytesToGet) ? availBytesFromMic : maxBytesToGet;
//_debug("available = %d, maxBytesToGet = %d\n", availBytesFromMic, maxBytesToGet);
// Get bytes from micRingBuffer to data_from_mic // Get bytes from micRingBuffer to data_from_mic
nbSample_ = audiolayer->getMainBuffer()->getData (micData, bytesAvail, 100, currentCall->getCallId()) / sizeof (SFLDataFormat); nbSample_ = audiolayer->getMainBuffer()->getData (micData, bytesAvail, 100, currentCall->getCallId()) / sizeof (SFLDataFormat);
// Store the number of samples for recording // Store the number of samples for recording
nbSampleForRec_ = nbSample_; nbSampleForRec_ = nbSample_;
// _debug("IAXVoIPLink::sendAudioFromMic : %i \n",nbSampleForRec_);
if (ac->getClockRate() && (ac->getClockRate() != _mainBufferSampleRate)) { if (ac->getClockRate() && (ac->getClockRate() != _mainBufferSampleRate)) {
...@@ -359,10 +355,12 @@ IAXVoIPLink::sendAudioFromMic (void) ...@@ -359,10 +355,12 @@ IAXVoIPLink::sendAudioFromMic (void)
// for the mono: range = 0 to IAX_FRAME2SEND * sizeof(int16) // for the mono: range = 0 to IAX_FRAME2SEND * sizeof(int16)
compSize = ac->codecEncode (micDataEncoded, micDataConverted , nbSample_*sizeof (int16)); compSize = ac->codecEncode (micDataEncoded, micDataConverted , nbSample_*sizeof (int16));
} else { } else {
// for the mono: range = 0 to IAX_FRAME2SEND * sizeof(int16) // for the mono: range = 0 to IAX_FRAME2SEND * sizeof(int16)
compSize = ac->codecEncode (micDataEncoded, micData, nbSample_*sizeof (int16)); compSize = ac->codecEncode (micDataEncoded, micData, nbSample_*sizeof (int16));
} }
// Send it out! // Send it out!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment