fix RTP timestamps in G.729 decoder

also fixes SRTP auth tag passed to transcoder

closes #501

Change-Id: I2253d1372784d0332b8449f8fb8087a2f7e4c699
changes/19/20019/3
Richard Fuchs 7 years ago
parent 16024d2e7a
commit ce44eaf1d3

@ -1360,8 +1360,13 @@ static int media_packet_decrypt(struct packet_handler_ctx *phc)
/* return values are: 0 = forward packet, -1 = error/dont forward,
* 1 = forward and push update to redis */
int ret = 0;
if (phc->decrypt_func)
if (phc->decrypt_func) {
str ori_s = phc->s;
ret = phc->decrypt_func(&phc->s, phc->in_srtp, phc->mp.sfd, &phc->mp.fsin, &phc->mp.tv, phc->mp.ssrc_in);
// XXX for stripped auth tag and duplicate invokations of rtp_payload
// XXX transcoder uses phc->mp.payload
phc->mp.payload.len -= ori_s.len - phc->s.len;
}
mutex_unlock(&phc->in_srtp->in_lock);

@ -1250,6 +1250,7 @@ static const char *bcg729_decoder_init(decoder_t *dec) {
static int bcg729_decoder_input(decoder_t *dec, const str *data, GQueue *out) {
str input = *data;
u_int64_t pts = dec->pts;
while (input.len >= 2) {
int frame_len = input.len >= 10 ? 10 : 2;
@ -1262,9 +1263,12 @@ static int bcg729_decoder_input(decoder_t *dec, const str *data, GQueue *out) {
frame->format = AV_SAMPLE_FMT_S16;
frame->sample_rate = dec->in_format.clockrate; // 8000
frame->channel_layout = av_get_default_channel_layout(dec->in_format.channels); // 1 channel
frame->pts = pts;
if (av_frame_get_buffer(frame, 0) < 0)
abort();
pts += frame->nb_samples;
// XXX handle lost packets and comfort noise
bcg729Decoder(dec->u.bcg729, (void *) inp_frame.s, inp_frame.len, 0, 0, 0,
(void *) frame->extended_data[0]);

Loading…
Cancel
Save