]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavformat/rtpproto.c
frsh: Export information about the last RTP contract and VRES
[frescor/ffmpeg.git] / libavformat / rtpproto.c
index 727c799619801d4104b29f6151a153353d21e8b0..ebfdf4a3f66828001ec0b749abefe56c664623d8 100644 (file)
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+int frsh_rtp_budget=0, frsh_rtp_period_ms=0, frsh_rtp_deadline_ms=0;
+
 /**
  * @file libavformat/rtpproto.c
  * RTP protocol
@@ -109,7 +111,7 @@ static void build_udp_url(char *buf, int buf_size,
                           const char *hostname, int port,
                           int local_port, int ttl,
                           int max_packet_size,
-                         const char *label)
+                         const char *label, int budget, int period_ms, int deadline_ms)
 {
     snprintf(buf, buf_size, URL_PROTO"://%s:%d", hostname, port);
     if (local_port >= 0)
@@ -120,6 +122,12 @@ static void build_udp_url(char *buf, int buf_size,
         url_add_option(buf, buf_size, "pkt_size=%d", max_packet_size);
     if (label)
         url_add_option(buf, buf_size, "contract_label=%s", label);
+    if (budget >=0)
+        url_add_option(buf, buf_size, "budget=%d", budget);
+    if (period_ms >=0)
+        url_add_option(buf, buf_size, "period=%d", period_ms);
+    if (deadline_ms >=0)
+        url_add_option(buf, buf_size, "deadline=%d", deadline_ms);
 }
 
 /**
@@ -138,6 +146,9 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
     char buf[1024];
     char path[1024];
     const char *p;
+    int budget=frsh_rtp_budget;
+    int period_ms=frsh_rtp_period_ms;
+    int deadline_ms=frsh_rtp_deadline_ms;
 
     is_output = (flags & URL_WRONLY);
 
@@ -164,10 +175,20 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
         if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
             max_packet_size = strtol(buf, NULL, 10);
         }
+        if (find_info_tag(buf, sizeof(buf), "budget", p)) {
+           budget = strtol(buf, NULL, 10);
+        }
+        if (find_info_tag(buf, sizeof(buf), "period", p)) {
+           period_ms = strtol(buf, NULL, 10);
+        }
+        if (find_info_tag(buf, sizeof(buf), "deadline", p)) {
+           deadline_ms = strtol(buf, NULL, 10);
+        }
     }
 
     build_udp_url(buf, sizeof(buf),
-                  hostname, port, local_port, ttl, max_packet_size, "RTP");
+                  hostname, port, local_port, ttl, max_packet_size, "RTP",
+                 budget, period_ms, deadline_ms);
     if (url_open(&s->rtp_hd, buf, flags) < 0)
         goto fail;
     local_port = udp_get_local_port(s->rtp_hd);
@@ -176,7 +197,8 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
     /* well, should suppress localport in path */
 
     build_udp_url(buf, sizeof(buf),
-                  hostname, port + 1, local_port + 1, ttl, max_packet_size, "RTCP");
+                  hostname, port + 1, local_port + 1, ttl, max_packet_size, "RTCP",
+                 1000, 100*1000, 0);
     if (url_open(&s->rtcp_hd, buf, flags) < 0)
         goto fail;