Browse Source

avoid calling a non existant encoder

fixes #925

Change-Id: I4743f0e87234fe3ddeb36b7355dcf80f651996c3
pull/940/head
Richard Fuchs 6 years ago
parent
commit
088c58d88d
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      daemon/codec.c

+ 11
- 0
daemon/codec.c View File

@ -1032,6 +1032,9 @@ static void packet_dtmf_fwd(struct codec_ssrc_handler *ch, struct transcode_pack
// this is actually a DTMF -> PCM handler // this is actually a DTMF -> PCM handler
// grab our underlying PCM transcoder // grab our underlying PCM transcoder
struct codec_ssrc_handler *output_ch = __output_ssrc_handler(ch, mp); struct codec_ssrc_handler *output_ch = __output_ssrc_handler(ch, mp);
if (G_UNLIKELY(!ch->encoder))
goto skip;
// init some vars // init some vars
if (!ch->first_ts) if (!ch->first_ts)
ch->first_ts = output_ch->first_ts; ch->first_ts = output_ch->first_ts;
@ -1072,6 +1075,7 @@ static void packet_dtmf_fwd(struct codec_ssrc_handler *ch, struct transcode_pack
obj_put(&output_ch->h); obj_put(&output_ch->h);
} }
skip:;
char *buf = malloc(packet->payload->len + sizeof(struct rtp_header) + RTP_BUFFER_TAIL_ROOM); char *buf = malloc(packet->payload->len + sizeof(struct rtp_header) + RTP_BUFFER_TAIL_ROOM);
memcpy(buf + sizeof(struct rtp_header), packet->payload->s, packet->payload->len); memcpy(buf + sizeof(struct rtp_header), packet->payload->s, packet->payload->len);
if (packet->ignore_seq) // inject original seq if (packet->ignore_seq) // inject original seq
@ -1567,6 +1571,13 @@ static int __packet_decoded(decoder_t *decoder, AVFrame *frame, void *u1, void *
goto discard; goto discard;
} }
if (G_UNLIKELY(!ch->encoder)) {
ilog(LOG_INFO | LOG_FLAG_LIMIT,
"Discarding decoded %i PCM samples due to lack of output encoder",
frame->nb_samples);
goto discard;
}
__dtmf_detect(ch, frame); __dtmf_detect(ch, frame);
encoder_input_fifo(ch->encoder, frame, __packet_encoded, ch, mp); encoder_input_fifo(ch->encoder, frame, __packet_encoded, ch, mp);


Loading…
Cancel
Save