Browse Source

TT#122401 add ptime to DTX trigger

Change-Id: I96aabff398cbe296243d8bdf7499468c6da96352
rfuchs/1283
Richard Fuchs 5 years ago
parent
commit
da06ed217b
3 changed files with 11 additions and 10 deletions
  1. +1
    -1
      daemon/codec.c
  2. +8
    -7
      lib/codeclib.c
  3. +2
    -2
      lib/codeclib.h

+ 1
- 1
daemon/codec.c View File

@ -2580,7 +2580,7 @@ static void __dtx_send_later(struct timerthread_queue *ttq, void *p) {
// synthetic packet
mp_copy.rtp->seq_num += htons(1);
ret = decoder_dtx(ch->decoder, ts,
ret = decoder_dtx(ch->decoder, ts, dtxb->ptime,
ch->handler->packet_decoded, ch, &mp_copy);
if (ret)
ilogs(dtx, LOG_WARN | LOG_FLAG_LIMIT,


+ 8
- 7
lib/codeclib.c View File

@ -61,7 +61,7 @@ static int cn_decoder_input(decoder_t *dec, const str *data, GQueue *out);
static int format_cmp_ignore(const struct rtp_payload_type *, const struct rtp_payload_type *);
static int amr_dtx(decoder_t *, GQueue *);
static int amr_dtx(decoder_t *, GQueue *, int);
@ -682,7 +682,7 @@ err:
return -1;
}
static int __decoder_input_data(decoder_t *dec, const str *data, unsigned long ts,
static int __decoder_input_data(decoder_t *dec, const str *data, unsigned long ts, int ptime,
int (*callback)(decoder_t *, AVFrame *, void *u1, void *u2), void *u1, void *u2)
{
GQueue frames = G_QUEUE_INIT;
@ -719,7 +719,7 @@ static int __decoder_input_data(decoder_t *dec, const str *data, unsigned long t
if (data)
dec->def->codec_type->decoder_input(dec, data, &frames);
else
dec->def->dtx(dec, &frames);
dec->def->dtx(dec, &frames, ptime);
AVFrame *frame;
int ret = 0;
@ -743,12 +743,12 @@ int decoder_input_data(decoder_t *dec, const str *data, unsigned long ts,
{
if (!data || !data->s || !data->len)
return 0;
return __decoder_input_data(dec, data, ts, callback, u1, u2);
return __decoder_input_data(dec, data, ts, 0, callback, u1, u2);
}
int decoder_dtx(decoder_t *dec, unsigned long ts,
int decoder_dtx(decoder_t *dec, unsigned long ts, int ptime,
int (*callback)(decoder_t *, AVFrame *, void *u1, void *u2), void *u1, void *u2)
{
return __decoder_input_data(dec, NULL, ts, callback, u1, u2);
return __decoder_input_data(dec, NULL, ts, ptime, callback, u1, u2);
}
@ -2113,7 +2113,8 @@ static int packetizer_amr(AVPacket *pkt, GString *buf, str *output, encoder_t *e
return 0;
}
static int amr_dtx(decoder_t *dec, GQueue *out) {
static int amr_dtx(decoder_t *dec, GQueue *out, int ptime) {
// ignore ptime, must be 20
ilog(LOG_DEBUG, "pushing empty/lost frame to AMR decoder");
unsigned char frame_buf[1];
frame_buf[0] = 0xf << 3; // no data


+ 2
- 2
lib/codeclib.h View File

@ -72,7 +72,7 @@ typedef void format_init_f(struct rtp_payload_type *);
typedef void set_enc_options_f(encoder_t *, const str *, const str *);
typedef void set_dec_options_f(decoder_t *, const str *, const str *);
typedef int format_cmp_f(const struct rtp_payload_type *, const struct rtp_payload_type *);
typedef int decoder_dtx_f(decoder_t *, GQueue *);
typedef int decoder_dtx_f(decoder_t *, GQueue *, int);
@ -280,7 +280,7 @@ decoder_t *decoder_new_fmtp(const codec_def_t *def, int clockrate, int channels,
void decoder_close(decoder_t *dec);
int decoder_input_data(decoder_t *dec, const str *data, unsigned long ts,
int (*callback)(decoder_t *, AVFrame *, void *u1, void *u2), void *u1, void *u2);
int decoder_dtx(decoder_t *dec, unsigned long ts,
int decoder_dtx(decoder_t *dec, unsigned long ts, int ptime,
int (*callback)(decoder_t *, AVFrame *, void *u1, void *u2), void *u1, void *u2);


Loading…
Cancel
Save