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:
Andreas Eversberg
2022-07-31 07:55:14 +02:00
parent 4fc92eba45
commit 2b7efedc48
42 changed files with 544 additions and 206 deletions

View File

@@ -335,7 +335,7 @@ static int super_send_bit(void *inst)
void sender_send(sender_t *sender, sample_t *samples, uint8_t *power, int length)
{
r2000_t *r2000 = (r2000_t *) sender;
int count;
int count, input_num;
again:
switch (r2000->dsp_mode) {
@@ -346,7 +346,9 @@ again:
case DSP_MODE_AUDIO_TX:
case DSP_MODE_AUDIO_TX_RX:
memset(power, 1, length);
jitter_load(&r2000->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);
iir_process(&r2000->super_tx_hp, samples, length);
/* do pre-emphasis */
if (r2000->pre_emphasis)

View File

@@ -1529,7 +1529,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)
{
sender_t *sender;
r2000_t *r2000;
@@ -1544,11 +1544,9 @@ void call_down_audio(int callref, sample_t *samples, int count)
if (r2000->dsp_mode == DSP_MODE_AUDIO_TX
|| r2000->dsp_mode == DSP_MODE_AUDIO_TX_RX) {
sample_t up[(int)((double)count * r2000->sender.srstate.factor + 0.5) + 10];
if (r2000->compandor)
compress_audio(&r2000->cstate, samples, count);
count = samplerate_upsample(&r2000->sender.srstate, samples, count, up);
jitter_save(&r2000->sender.dejitter, up, count);
jitter_save(&r2000->sender.dejitter, samples, count, 1, sequence, timestamp, ssrc);
}
}