diff rtsp.c @ 1425:00d9393a126f libavformat

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
author gpoirier
date Fri, 27 Oct 2006 18:19:29 +0000
parents 1c39ce5c6a5d
children 2d8a17631520
line wrap: on
line diff
--- a/rtsp.c	Fri Oct 27 17:51:20 2006 +0000
+++ b/rtsp.c	Fri Oct 27 18:19:29 2006 +0000
@@ -884,7 +884,7 @@
             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 @@
                          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 @@
             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 @@
     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 @@
                  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 @@
             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;