From b56fc18b20d62c3d2a134b53738deaabfd491e89 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Tue, 13 Aug 2013 13:21:35 +0300 Subject: sdp: Add an option for sending RTCP packets to the source of the last packets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An SDP description normally only contains the target IP address and port for the packets. This means that we don't really have any clue where to send the RTCP RR packets - previously they're sent to the destination IP written in the SDP (at the same port), which rarely is the actual peer. And if the source for the packets is on a different port than the destination, it's never correct. With a new option, we can choose to send the packets to the address that the latest packet on each socket arrived from. --- Some may even argue that this should be the default - perhaps, but I'd rather keep it optional at first. Additionally, I'm not sure if sending RTCP RR directly back to the source is desireable for e.g. multicast. Signed-off-by: Martin Storsjö --- libavformat/rtsp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libavformat/rtsp.c') diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 21b693368b..16b5d416f2 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -96,6 +96,7 @@ const AVOption ff_rtsp_options[] = { static const AVOption sdp_options[] = { RTSP_FLAG_OPTS("sdp_flags", "SDP flags"), { "custom_io", "Use custom IO", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_CUSTOM_IO}, 0, 0, DEC, "rtsp_flags" }, + { "rtcp_to_source", "Send RTCP packets to the source address of received packets", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_RTCP_TO_SOURCE}, 0, 0, DEC, "rtsp_flags" }, RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"), RTSP_REORDERING_OPTS(), { NULL }, @@ -2172,9 +2173,10 @@ static int sdp_read_header(AVFormatContext *s) namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, rtsp_st->sdp_port, - "?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port, - rtsp_st->sdp_ttl, - rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0); + "?localport=%d&ttl=%d&connect=%d&write_to_source=%d", + rtsp_st->sdp_port, rtsp_st->sdp_ttl, + rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0, + rt->rtsp_flags & RTSP_FLAG_RTCP_TO_SOURCE ? 1 : 0); append_source_addrs(url, sizeof(url), "sources", rtsp_st->nb_include_source_addrs, -- cgit v1.2.3