From 0c378ea1f76e226eff460c84634e7227e3705372 Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Fri, 23 Sep 2011 15:47:56 -0400 Subject: rtp: factorize dynamic payload type fallback Move the identical code in rtp_write_header() and ff_sdp_write_media() inside ff_rtp_get_payload_type() Signed-off-by: Luca Barbato --- libavformat/rtp.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libavformat/rtp.c') diff --git a/libavformat/rtp.c b/libavformat/rtp.c index d59b6941b6..35edb5066a 100644 --- a/libavformat/rtp.c +++ b/libavformat/rtp.c @@ -103,6 +103,11 @@ int ff_rtp_get_payload_type(AVCodecContext *codec) continue; payload_type = AVRtpPayloadTypes[i].pt; } + + /* dynamic payload type */ + if (payload_type < 0) + payload_type = RTP_PT_PRIVATE + (codec->codec_type == AVMEDIA_TYPE_AUDIO); + return payload_type; } -- cgit v1.2.3