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
(cherry picked from commit 0949e6384a)
changes/57/28757/1
Richard Fuchs 7 years ago
parent
commit
bd068124a2
3 changed files with 21 additions and 1 deletions
  1. +15
    -0
      lib/auxlib.h
  2. +3
    -0
      lib/codeclib.c
  3. +3
    -1
      recording-daemon/decoder.c

+ 15
- 0
lib/auxlib.h View File

@ -30,4 +30,19 @@ INLINE void random_string(unsigned char *buf, int len) {
assert(ret == 1);
}
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

@ -602,6 +602,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);
@ -902,6 +904,7 @@ int packet_sequencer_insert(packet_sequencer_t *ps, seq_packet_t *p) {
ilog(LOG_DEBUG, "Seq reset detected: expected seq %i, received seq %i", ps->seq, p->seq);
ps->seq = p->seq;
// 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

@ -48,6 +48,8 @@ decoder_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
@ -69,7 +71,7 @@ decoder_t *decoder_new(const char *payload_str, output_t *outp) {
outp->encoder->requested_format.format = out_format.format;
}
return decoder_new_fmt(def, clockrate, channels, &out_format);
return decoder_new_fmt(def, rtp_clockrate, channels, &out_format);
}


Loading…
Cancel
Save