Ported to new jitter buffer API

master
Andreas Eversberg 3 months ago
parent 502a95ada3
commit 6330b4e2cb
  1. 9
      src/ss5/dsp.c
  2. 2
      src/ss5/dsp.h
  3. 6
      src/ss5/ss5.c
  4. 2
      src/ss5/ss5.h

@ -417,8 +417,8 @@ static void process_audio(ss5_t *ss5_a, ss5_t *ss5_b, int length)
osmo_cc_session_handle(ss5_b->cc_session);
/* get audio from jitter buffer */
jitter_load(&ss5_a->dejitter, samples[0], length);
jitter_load(&ss5_b->dejitter, samples[1], length);
jitter_load(&ss5_a->tx_dejitter, samples[0], length);
jitter_load(&ss5_b->tx_dejitter, samples[1], length);
/* optionally add comfort noise */
if (!ss5_a->cc_callref && ss5_a->ss5_ep->comfort_noise) {
@ -516,10 +516,11 @@ void audio_clock(ss5_endpoint_t *ss5_ep_sunset, ss5_endpoint_t *ss5_ep_sunrise,
void down_audio(struct osmo_cc_session_codec *codec, uint8_t __attribute__((unused)) marker, uint16_t sequence, uint32_t timestamp, uint32_t ssrc, uint8_t *data, int len)
{
ss5_t *ss5 = codec->media->session->priv;
sample_t samples[len / 2];
int count = len/2;
sample_t samples[count];
int16_to_samples_1mw(samples, (int16_t *)data, count);
jitter_save(&ss5->dejitter, samples, len / 2);
jitter_save(&ss5->tx_dejitter, samples, count, 1, sequence, timestamp, ssrc);
}
void encode_l16(uint8_t *src_data, int src_len, uint8_t **dst_data, int *dst_len)

@ -37,7 +37,7 @@ void set_sig_detect_duration(dsp_t *dsp, double duration_AB, double duration_C);
void set_tone(dsp_t *dsp, char tone, double duration);
void set_dial_string(dsp_t *dsp, const char *dial);
void audio_clock(struct ss5_endpoint *ss5_ep_sunset, struct ss5_endpoint *ss5_ep_sunrise, int len);
void down_audio(struct osmo_cc_session_codec *codec, uint16_t __attribute__((unused)) sequence_number, uint32_t __attribute__((unused)) timestamp, uint8_t *data, int len);
void down_audio(struct osmo_cc_session_codec *codec, uint8_t marker, uint16_t sequence, uint32_t timestamp, uint32_t ssrc, uint8_t *data, int len);
void encode_l16(uint8_t *src_data, int src_len, uint8_t **dst_data, int *dst_len);
void decode_l16(uint8_t *src_data, int src_len, uint8_t **dst_data, int *dst_len);

@ -138,7 +138,7 @@ static void link_reset(ss5_t *ss5)
}
/* reset jitter buffer */
jitter_reset(&ss5->dejitter);
jitter_reset(&ss5->tx_dejitter);
/* set recognition time */
set_sig_detect_duration(&ss5->dsp, SIGN_RECOGNITION_FAST, SIGN_RECOGNITION_NORMAL);
@ -180,7 +180,7 @@ static ss5_t *link_create(ss5_endpoint_t *ss5_ep, const char *ep_name, int linki
timer_init(&ss5->timer, ss5_timeout, ss5);
/* allocate jitter buffer */
rc = jitter_create(&ss5->dejitter, 8000 / 10); // FIXME: size
rc = jitter_create(&ss5->tx_dejitter, "tx", 8000, sizeof(sample_t), JITTER_DATA);
if (rc < 0)
abort();
@ -215,7 +215,7 @@ static void link_destroy(ss5_t *ss5)
timer_exit(&ss5->timer);
/* free jitter buffer */
jitter_destroy(&ss5->dejitter);
jitter_destroy(&ss5->tx_dejitter);
/* free delay buffer */
if (ss5->delay_buffer) {

@ -58,7 +58,7 @@ typedef struct ss5 {
char dialing[33]; /* current dial string (send or receive) */
/* audio processing */
jitter_t dejitter; /* jitter buffer for audio from CC */
jitter_t tx_dejitter; /* jitter buffer for audio from CC */
dsp_t dsp; /* all dsp processing */
sample_t *delay_buffer; /* buffer for delaying audio */
int delay_length;

Loading…
Cancel
Save