TT#64259 add functions to skip decoded samples and return encoder PTS

Change-Id: I9b4f39e214bf6ecb7ae25a8b3cc726041d6552c0
changes/69/32469/1
Richard Fuchs 6 years ago
parent 35740cda35
commit 68d909c5ea

@ -83,6 +83,8 @@ struct codec_ssrc_handler {
GQueue dtmf_events;
struct dtmf_event dtmf_event;
uint64_t skip_pts;
int rtp_mark:1;
};
struct transcode_packet {
@ -1245,6 +1247,15 @@ void codec_add_dtmf_event(struct codec_ssrc_handler *ch, int code, int level, ui
g_queue_push_tail(&ch->dtmf_events, ev);
}
uint64_t codec_encoder_pts(struct codec_ssrc_handler *ch) {
return ch->encoder->fifo_pts;
}
void codec_decoder_skip_pts(struct codec_ssrc_handler *ch, uint64_t pts) {
ilog(LOG_DEBUG, "Skipping next %" PRIu64 " samples", pts);
ch->skip_pts += pts;
}
static struct ssrc_entry *__ssrc_handler_transcode_new(void *p) {
struct codec_handler *h = p;
@ -1471,10 +1482,22 @@ static int __packet_decoded(decoder_t *decoder, AVFrame *frame, void *u1, void *
ch = new_ch;
}
if (ch->skip_pts) {
if (frame->nb_samples <= 0)
;
else if (frame->nb_samples < ch->skip_pts)
ch->skip_pts -= frame->nb_samples;
else
ch->skip_pts = 0;
ilog(LOG_DEBUG, "Discarding %i samples", frame->nb_samples);
goto discard;
}
__dtmf_detect(ch, frame);
encoder_input_fifo(ch->encoder, frame, __packet_encoded, ch, mp);
discard:
av_frame_free(&frame);
//mp->iter_out++;

@ -75,6 +75,8 @@ void __rtp_payload_type_add_send(struct call_media *other_media, struct rtp_payl
void codec_handlers_update(struct call_media *receiver, struct call_media *sink, const struct sdp_ng_flags *);
void codec_add_dtmf_event(struct codec_ssrc_handler *ch, int code, int level, uint64_t ts);
uint64_t codec_encoder_pts(struct codec_ssrc_handler *ch);
void codec_decoder_skip_pts(struct codec_ssrc_handler *ch, uint64_t);
#else

Loading…
Cancel
Save