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:
@@ -1065,7 +1065,7 @@ void call_down_release(int callref, int 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;
|
||||
amps_t *amps;
|
||||
@@ -1079,10 +1079,8 @@ void call_down_audio(int callref, sample_t *samples, int count)
|
||||
return;
|
||||
|
||||
if (amps->dsp_mode == DSP_MODE_AUDIO_RX_AUDIO_TX) {
|
||||
sample_t up[(int)((double)count * amps->sender.srstate.factor + 0.5) + 10];
|
||||
compress_audio(&s->cstate, samples, count);
|
||||
count = samplerate_upsample(&s->sender.srstate, samples, count, up);
|
||||
jitter_save(&s->sender.dejitter, up, count);
|
||||
jitter_save(&s->sender.dejitter, samples, count, 1, sequence, timestamp, ssrc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -473,7 +473,7 @@ static void sat_encode(amps_t *amps, sample_t *samples, int length)
|
||||
void sender_send(sender_t *sender, sample_t *samples, uint8_t *power, int length)
|
||||
{
|
||||
amps_t *amps = (amps_t *) sender;
|
||||
int count;
|
||||
int count, input_num;
|
||||
|
||||
again:
|
||||
switch (amps->dsp_mode) {
|
||||
@@ -483,7 +483,9 @@ again:
|
||||
break;
|
||||
case DSP_MODE_AUDIO_RX_AUDIO_TX:
|
||||
memset(power, 1, length);
|
||||
jitter_load(&s->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);
|
||||
/* pre-emphasis */
|
||||
if (amps->pre_emphasis)
|
||||
pre_emphasis(&s->estate, samples, length);
|
||||
|
Reference in New Issue
Block a user