Ticket #1774: rtpproto-add-reuse-option.patch

File rtpproto-add-reuse-option.patch, 2.8 KB (added by tmatth, 4 years ago)

Patch to add reuse option to rtpproto

  • libavformat/rtpproto.c

    From 88d2e1238610a9b72b0bbd64716bcb866d6d8d38 Mon Sep 17 00:00:00 2001
    From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
    Date: Fri, 28 Sep 2012 11:59:09 -0400
    Subject: [PATCH 1/1] rtpproto: add "reuse" option
    
    ---
     libavformat/rtpproto.c | 15 +++++++++++----
     1 file changed, 11 insertions(+), 4 deletions(-)
    
    diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
    index 17b0f64..c17ac80 100644
    a b static av_printf_format(3, 4) void url_add_option(char *buf, int buf_size, const 
    102102static void build_udp_url(char *buf, int buf_size, 
    103103                          const char *hostname, int port, 
    104104                          int local_port, int ttl, 
    105                           int max_packet_size, int connect) 
     105                          int max_packet_size, int connect, 
     106                          int reuse) 
    106107{ 
    107108    ff_url_join(buf, buf_size, "udp", NULL, hostname, port, NULL); 
    108109    if (local_port >= 0) 
    static void build_udp_url(char *buf, int buf_size, 
    113114        url_add_option(buf, buf_size, "pkt_size=%d", max_packet_size); 
    114115    if (connect) 
    115116        url_add_option(buf, buf_size, "connect=1"); 
     117    if (reuse) 
     118        url_add_option(buf, buf_size, "reuse=1"); 
    116119    url_add_option(buf, buf_size, "fifo_size=0"); 
    117120} 
    118121 
    static int rtp_open(URLContext *h, const char *uri, int flags) 
    137140{ 
    138141    RTPContext *s = h->priv_data; 
    139142    int rtp_port, rtcp_port, 
    140         ttl, connect, 
     143        ttl, connect, reuse, 
    141144        local_rtp_port, local_rtcp_port, max_packet_size; 
    142145    char hostname[256]; 
    143146    char buf[1024]; 
    static int rtp_open(URLContext *h, const char *uri, int flags) 
    153156    local_rtcp_port = -1; 
    154157    max_packet_size = -1; 
    155158    connect = 0; 
     159    reuse = 0; 
    156160 
    157161    p = strchr(uri, '?'); 
    158162    if (p) { 
    static int rtp_open(URLContext *h, const char *uri, int flags) 
    177181        if (av_find_info_tag(buf, sizeof(buf), "connect", p)) { 
    178182            connect = strtol(buf, NULL, 10); 
    179183        } 
     184        if (av_find_info_tag(buf, sizeof(buf), "reuse", p)) { 
     185            reuse = strtol(buf, NULL, 10); 
     186        } 
    180187    } 
    181188 
    182189    build_udp_url(buf, sizeof(buf), 
    183190                  hostname, rtp_port, local_rtp_port, ttl, max_packet_size, 
    184                   connect); 
     191                  connect, reuse); 
    185192    if (ffurl_open(&s->rtp_hd, buf, flags, &h->interrupt_callback, NULL) < 0) 
    186193        goto fail; 
    187194    if (local_rtp_port>=0 && local_rtcp_port<0) 
    static int rtp_open(URLContext *h, const char *uri, int flags) 
    189196 
    190197    build_udp_url(buf, sizeof(buf), 
    191198                  hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size, 
    192                   connect); 
     199                  connect, 0); 
    193200    if (ffurl_open(&s->rtcp_hd, buf, flags, &h->interrupt_callback, NULL) < 0) 
    194201        goto fail; 
    195202