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:
@@ -276,7 +276,7 @@ static int generate_tone(imts_t *imts, sample_t *samples, int length)
|
||||
void sender_send(sender_t *sender, sample_t *samples, uint8_t *power, int length)
|
||||
{
|
||||
imts_t *imts = (imts_t *) sender;
|
||||
int count;
|
||||
int count, input_num;
|
||||
|
||||
memset(power, 1, length);
|
||||
|
||||
@@ -296,7 +296,9 @@ again:
|
||||
break;
|
||||
case DSP_MODE_AUDIO:
|
||||
memset(power, 1, length);
|
||||
jitter_load(&imts->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);
|
||||
if (imts->pre_emphasis)
|
||||
pre_emphasis(&imts->estate, samples, length);
|
||||
break;
|
||||
|
@@ -1284,7 +1284,7 @@ void call_down_release(int callref, __attribute__((unused)) 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;
|
||||
imts_t *imts;
|
||||
@@ -1298,9 +1298,7 @@ void call_down_audio(int callref, sample_t *samples, int count)
|
||||
return;
|
||||
|
||||
if (imts->dsp_mode == DSP_MODE_AUDIO) {
|
||||
sample_t up[(int)((double)count * imts->sender.srstate.factor + 0.5) + 10];
|
||||
count = samplerate_upsample(&imts->sender.srstate, samples, count, up);
|
||||
jitter_save(&imts->sender.dejitter, up, count);
|
||||
jitter_save(&imts->sender.dejitter, samples, count, 1, sequence, timestamp, ssrc);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user