Refactoring jitter buffer
Features are: * Packet based buffer * Random in, first out * Adaptive delay compensation (voice) * Fixed delay (data, optionally MODEM/FAX) * Interpolation of missing frames * Any sample size
This commit is contained in:
@@ -446,7 +446,7 @@ static void dial_tone(nmt_t *nmt, sample_t *samples, int length)
|
||||
void sender_send(sender_t *sender, sample_t *samples, uint8_t *power, int length)
|
||||
{
|
||||
nmt_t *nmt = (nmt_t *) sender;
|
||||
int count;
|
||||
int count, input_num;
|
||||
|
||||
memset(power, 1, length);
|
||||
|
||||
@@ -454,7 +454,9 @@ again:
|
||||
switch (nmt->dsp_mode) {
|
||||
case DSP_MODE_AUDIO:
|
||||
case DSP_MODE_DTMF:
|
||||
jitter_load(&nmt->sender.dejitter, samples, length);
|
||||
input_num = samplerate_upsample_input_num(&sender->srstate, length);
|
||||
jitter_load(&sender->dejitter, samples, input_num);
|
||||
samplerate_upsample(&sender->srstate, samples, input_num, samples, length);
|
||||
/* send after dejitter, so audio is flushed */
|
||||
if (nmt->dms.tx_frame_valid) {
|
||||
fsk_mod_send(&nmt->fsk_mod, samples, length, 0);
|
||||
|
@@ -1954,7 +1954,7 @@ void call_down_release(int callref, int __attribute__((unused)) cause)
|
||||
}
|
||||
|
||||
/* Receive audio from call instance. */
|
||||
void call_down_audio(int callref, sample_t *samples, int count)
|
||||
void call_down_audio(int callref, uint16_t sequence, uint32_t timestamp, uint32_t ssrc, sample_t *samples, int count)
|
||||
{
|
||||
transaction_t *trans;
|
||||
nmt_t *nmt;
|
||||
@@ -1967,11 +1967,9 @@ void call_down_audio(int callref, sample_t *samples, int count)
|
||||
return;
|
||||
|
||||
if (nmt->dsp_mode == DSP_MODE_AUDIO || nmt->dsp_mode == DSP_MODE_DTMF) {
|
||||
sample_t up[(int)((double)count * nmt->sender.srstate.factor + 0.5) + 10];
|
||||
if (nmt->compandor)
|
||||
compress_audio(&nmt->cstate, samples, count);
|
||||
count = samplerate_upsample(&nmt->sender.srstate, samples, count, up);
|
||||
jitter_save(&nmt->sender.dejitter, up, count);
|
||||
jitter_save(&nmt->sender.dejitter, samples, count, 1, sequence, timestamp, ssrc);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user