avoid calling a non existant encoder

fixes #925

Change-Id: I4743f0e87234fe3ddeb36b7355dcf80f651996c3
pull/940/head
Richard Fuchs 5 years ago
parent 7ea6389c56
commit 088c58d88d

@ -1032,6 +1032,9 @@ static void packet_dtmf_fwd(struct codec_ssrc_handler *ch, struct transcode_pack
// this is actually a DTMF -> PCM handler
// grab our underlying PCM transcoder
struct codec_ssrc_handler *output_ch = __output_ssrc_handler(ch, mp);
if (G_UNLIKELY(!ch->encoder))
goto skip;
// init some vars
if (!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);
}
skip:;
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);
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;
}
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);
encoder_input_fifo(ch->encoder, frame, __packet_encoded, ch, mp);

Loading…
Cancel
Save