From 8034130e06b03859af9ce64f7ee653cd14df328d Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 11 Nov 2012 20:44:28 +0100 Subject: rtp: set the payload type as stream id Support multiple video/audio streams with different format in the same session. Signed-off-by: Luca Barbato --- libavformat/rtpenc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'libavformat/rtpenc.c') diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index b17c4651b6..babb2bb45f 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -101,8 +101,17 @@ static int rtp_write_header(AVFormatContext *s1) return -1; } - if (s->payload_type < 0) - s->payload_type = ff_rtp_get_payload_type(s1, st->codec); + if (s->payload_type < 0) { + /* Re-validate non-dynamic payload types */ + if (st->id < RTP_PT_PRIVATE) + st->id = ff_rtp_get_payload_type(s1, st->codec, -1); + + s->payload_type = st->id; + } else { + /* private option takes priority */ + st->id = s->payload_type; + } + s->base_timestamp = av_get_random_seed(); s->timestamp = s->base_timestamp; s->cur_timestamp = 0; -- cgit v1.2.3