Browse Source

TT#56553 fix double G.722 sample rate issues

Fixes missing RTP TS rescaling
Fixes double clock rate adjustment
Fixes sequencer not releasing packets after seq reset
Fixes #748

Change-Id: Ic6021ab6fd781cd291c0aba3e03633f565908c29
changes/52/28752/1
Richard Fuchs 7 years ago
parent
commit
2cfb80f56c
3 changed files with 23 additions and 1 deletions
  1. +17
    -0
      lib/auxlib.h
  2. +3
    -0
      lib/codeclib.c
  3. +3
    -1
      recording-daemon/decoder.c

+ 17
- 0
lib/auxlib.h View File

@ -202,4 +202,21 @@ INLINE int __debug_rwlock_unlock_w(rwlock_t *m, const char *file, unsigned int l
/*** GLIB HELPERS ***/
INLINE int g_tree_clear_cb(void *k, void *v, void *p) {
GQueue *q = p;
g_queue_push_tail(q, k);
return 0;
}
INLINE void g_tree_clear(GTree *t) {
GQueue q = G_QUEUE_INIT;
g_tree_foreach(t, g_tree_clear_cb, &q);
while (q.length) {
void *k = g_queue_pop_head(&q);
g_tree_remove(t, k);
}
}
#endif

+ 3
- 0
lib/codeclib.c View File

@ -600,6 +600,8 @@ int decoder_input_data(decoder_t *dec, const str *data, unsigned long ts,
if (!data || !data->s || !data->len)
return 0;
ts *= dec->def->clockrate_mult;
dbg("%p dec pts %llu rtp_ts %llu incoming ts %lu", dec, (unsigned long long) dec->pts,
(unsigned long long) dec->rtp_ts, (unsigned long) ts);
@ -909,6 +911,7 @@ int packet_sequencer_insert(packet_sequencer_t *ps, seq_packet_t *p) {
ps->seq = p->seq;
ret = 1;
// seq ok - fall thru
g_tree_clear(ps->packets);
seq_ok:
if (g_tree_lookup(ps->packets, GINT_TO_POINTER(p->seq)))
return -1;


+ 3
- 1
recording-daemon/decoder.c View File

@ -56,6 +56,8 @@ decode_t *decoder_new(const char *payload_str, output_t *outp) {
if (def->avcodec_id == -1) // not a real audio codec
return NULL;
// decoder_new_fmt already handles the clockrate_mult scaling
int rtp_clockrate = clockrate;
clockrate *= def->clockrate_mult;
// we can now config our output, which determines the sample format we convert to
@ -77,7 +79,7 @@ decode_t *decoder_new(const char *payload_str, output_t *outp) {
outp->encoder->requested_format.format = out_format.format;
}
decoder_t *dec = decoder_new_fmt(def, clockrate, channels, &out_format);
decoder_t *dec = decoder_new_fmt(def, rtp_clockrate, channels, &out_format);
if (!dec)
return NULL;
decode_t *deco = g_slice_alloc0(sizeof(decode_t));


Loading…
Cancel
Save