From dbf30963f3599717e8ff90c0820bb7bfca94a38b Mon Sep 17 00:00:00 2001 From: Thijs Date: Fri, 27 Oct 2006 18:19:29 +0000 Subject: make ffmpeg able to send back a RTCP receiver report. Patch by Thijs thijsvermeir A telenet P be Original thread: Date: Oct 27, 2006 12:58 PM Subject: [Ffmpeg-devel] [PATCH proposal] RTCP receiver report Originally committed as revision 6805 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/rtsp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'libavformat/rtsp.c') diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index d340819..08c71c5 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -884,7 +884,7 @@ static int rtsp_read_header(AVFormatContext *s, if (RTSP_RTP_PORT_MIN != 0) { while(j <= RTSP_RTP_PORT_MAX) { snprintf(buf, sizeof(buf), "rtp://?localport=%d", j); - if (url_open(&rtsp_st->rtp_handle, buf, URL_RDONLY) == 0) { + if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0) { j += 2; /* we will use two port by rtp stream (rtp and rtcp) */ goto rtp_opened; } @@ -981,7 +981,7 @@ static int rtsp_read_header(AVFormatContext *s, host, reply->transports[0].server_port_min, ttl); - if (url_open(&rtsp_st->rtp_handle, url, URL_RDONLY) < 0) { + if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { err = AVERROR_INVALIDDATA; goto fail; } @@ -994,7 +994,7 @@ static int rtsp_read_header(AVFormatContext *s, st = s->streams[rtsp_st->stream_index]; if (!st) s->ctx_flags |= AVFMTCTX_NOHEADER; - rtsp_st->rtp_ctx = rtp_parse_open(s, st, rtsp_st->sdp_payload_type, &rtsp_st->rtp_payload_data); + rtsp_st->rtp_ctx = rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, &rtsp_st->rtp_payload_data); if (!rtsp_st->rtp_ctx) { err = AVERROR_NOMEM; @@ -1157,6 +1157,8 @@ static int rtsp_read_packet(AVFormatContext *s, case RTSP_PROTOCOL_RTP_UDP: case RTSP_PROTOCOL_RTP_UDP_MULTICAST: len = udp_read_packet(s, &rtsp_st, buf, sizeof(buf)); + if (rtsp_st->rtp_ctx) + rtp_check_and_send_back_rr(rtsp_st->rtp_ctx, len); break; } if (len < 0) @@ -1336,7 +1338,7 @@ static int sdp_read_header(AVFormatContext *s, inet_ntoa(rtsp_st->sdp_ip), rtsp_st->sdp_port, rtsp_st->sdp_ttl); - if (url_open(&rtsp_st->rtp_handle, url, URL_RDONLY) < 0) { + if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { err = AVERROR_INVALIDDATA; goto fail; } @@ -1346,7 +1348,7 @@ static int sdp_read_header(AVFormatContext *s, st = s->streams[rtsp_st->stream_index]; if (!st) s->ctx_flags |= AVFMTCTX_NOHEADER; - rtsp_st->rtp_ctx = rtp_parse_open(s, st, rtsp_st->sdp_payload_type, &rtsp_st->rtp_payload_data); + rtsp_st->rtp_ctx = rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, &rtsp_st->rtp_payload_data); if (!rtsp_st->rtp_ctx) { err = AVERROR_NOMEM; goto fail; -- cgit v1.1