|
|
@ -73,6 +73,7 @@ struct transcode_packet { |
|
|
ignore_seq:1; |
|
|
ignore_seq:1; |
|
|
int (*func)(struct codec_ssrc_handler *, struct transcode_packet *, struct media_packet *); |
|
|
int (*func)(struct codec_ssrc_handler *, struct transcode_packet *, struct media_packet *); |
|
|
void (*dup_func)(struct codec_ssrc_handler *, struct transcode_packet *, struct media_packet *); |
|
|
void (*dup_func)(struct codec_ssrc_handler *, struct transcode_packet *, struct media_packet *); |
|
|
|
|
|
struct rtp_header rtp; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -641,6 +642,9 @@ static int __handler_func_sequencer(struct codec_handler *h, struct media_packet |
|
|
seq_ret = 0; |
|
|
seq_ret = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// we might be working with a different packet now |
|
|
|
|
|
mp->rtp = &packet->rtp; |
|
|
|
|
|
|
|
|
if (packet->func(ch, packet, mp)) |
|
|
if (packet->func(ch, packet, mp)) |
|
|
ilog(LOG_WARN, "Decoder error while processing RTP packet"); |
|
|
ilog(LOG_WARN, "Decoder error while processing RTP packet"); |
|
|
__transcode_packet_free(packet); |
|
|
__transcode_packet_free(packet); |
|
|
@ -759,6 +763,7 @@ static int handler_func_dtmf(struct codec_handler *h, struct media_packet *mp) { |
|
|
packet->func = packet_dtmf; |
|
|
packet->func = packet_dtmf; |
|
|
packet->dup_func = packet_dtmf_dup; |
|
|
packet->dup_func = packet_dtmf_dup; |
|
|
packet->handler = h; // original handler for output RTP options (payload type) |
|
|
packet->handler = h; // original handler for output RTP options (payload type) |
|
|
|
|
|
packet->rtp = *mp->rtp; |
|
|
|
|
|
|
|
|
if (sequencer_h->kernelize) { |
|
|
if (sequencer_h->kernelize) { |
|
|
// this sequencer doesn't actually keep track of RTP seq properly. instruct |
|
|
// this sequencer doesn't actually keep track of RTP seq properly. instruct |
|
|
@ -978,7 +983,7 @@ static void __free_ssrc_handler(void *chp) { |
|
|
static int __packet_encoded(encoder_t *enc, void *u1, void *u2) { |
|
|
static int __packet_encoded(encoder_t *enc, void *u1, void *u2) { |
|
|
struct codec_ssrc_handler *ch = u1; |
|
|
struct codec_ssrc_handler *ch = u1; |
|
|
struct media_packet *mp = u2; |
|
|
struct media_packet *mp = u2; |
|
|
unsigned int seq_off = mp->iter ? 1 : 0; |
|
|
|
|
|
|
|
|
//unsigned int seq_off = (mp->iter_out > mp->iter_in) ? 1 : 0; |
|
|
|
|
|
|
|
|
ilog(LOG_DEBUG, "RTP media successfully encoded: TS %llu, len %i", |
|
|
ilog(LOG_DEBUG, "RTP media successfully encoded: TS %llu, len %i", |
|
|
(unsigned long long) enc->avpkt.pts, enc->avpkt.size); |
|
|
(unsigned long long) enc->avpkt.pts, enc->avpkt.size); |
|
|
@ -1011,8 +1016,9 @@ static int __packet_encoded(encoder_t *enc, void *u1, void *u2) { |
|
|
ilog(LOG_DEBUG, "Received packet of %i bytes from packetizer", inout.len); |
|
|
ilog(LOG_DEBUG, "Received packet of %i bytes from packetizer", inout.len); |
|
|
__output_rtp(mp, ch, ch->handler, buf, inout.len, ch->first_ts |
|
|
__output_rtp(mp, ch, ch->handler, buf, inout.len, ch->first_ts |
|
|
+ enc->avpkt.pts / enc->def->clockrate_mult, |
|
|
+ enc->avpkt.pts / enc->def->clockrate_mult, |
|
|
0, -1, seq_off); |
|
|
|
|
|
mp->iter++; |
|
|
|
|
|
|
|
|
0, -1, 0); |
|
|
|
|
|
mp->ssrc_out->parent->seq_diff++; |
|
|
|
|
|
//mp->iter_out++; |
|
|
|
|
|
|
|
|
if (ret == 0) { |
|
|
if (ret == 0) { |
|
|
// no more to go |
|
|
// no more to go |
|
|
@ -1021,7 +1027,7 @@ static int __packet_encoded(encoder_t *enc, void *u1, void *u2) { |
|
|
|
|
|
|
|
|
// loop around and get more |
|
|
// loop around and get more |
|
|
in_pkt = NULL; |
|
|
in_pkt = NULL; |
|
|
seq_off = 1; // next packet needs last seq + 1 XXX set unkernelize if used |
|
|
|
|
|
|
|
|
//seq_off = 1; // next packet needs last seq + 1 XXX set unkernelize if used |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
@ -1037,7 +1043,7 @@ static int __packet_decoded(decoder_t *decoder, AVFrame *frame, void *u1, void * |
|
|
encoder_input_fifo(ch->encoder, frame, __packet_encoded, ch, mp); |
|
|
encoder_input_fifo(ch->encoder, frame, __packet_encoded, ch, mp); |
|
|
|
|
|
|
|
|
av_frame_free(&frame); |
|
|
av_frame_free(&frame); |
|
|
mp->iter++; |
|
|
|
|
|
|
|
|
//mp->iter_out++; |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
@ -1046,7 +1052,10 @@ static int packet_decode(struct codec_ssrc_handler *ch, struct transcode_packet |
|
|
{ |
|
|
{ |
|
|
if (!ch->first_ts) |
|
|
if (!ch->first_ts) |
|
|
ch->first_ts = packet->ts; |
|
|
ch->first_ts = packet->ts; |
|
|
return decoder_input_data(ch->decoder, packet->payload, packet->ts, __packet_decoded, ch, mp); |
|
|
|
|
|
|
|
|
int ret = decoder_input_data(ch->decoder, packet->payload, packet->ts, __packet_decoded, ch, mp); |
|
|
|
|
|
//mp->iter_in++; |
|
|
|
|
|
mp->ssrc_out->parent->seq_diff--; |
|
|
|
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static int handler_func_transcode(struct codec_handler *h, struct media_packet *mp) { |
|
|
static int handler_func_transcode(struct codec_handler *h, struct media_packet *mp) { |
|
|
@ -1065,8 +1074,13 @@ static int handler_func_transcode(struct codec_handler *h, struct media_packet * |
|
|
|
|
|
|
|
|
struct transcode_packet *packet = g_slice_alloc0(sizeof(*packet)); |
|
|
struct transcode_packet *packet = g_slice_alloc0(sizeof(*packet)); |
|
|
packet->func = packet_decode; |
|
|
packet->func = packet_decode; |
|
|
|
|
|
packet->rtp = *mp->rtp; |
|
|
|
|
|
|
|
|
|
|
|
int ret = __handler_func_sequencer(h, mp, packet); |
|
|
|
|
|
|
|
|
return __handler_func_sequencer(h, mp, packet); |
|
|
|
|
|
|
|
|
//ilog(LOG_DEBUG, "tc iters: in %u out %u", mp->iter_in, mp->iter_out); |
|
|
|
|
|
|
|
|
|
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|