Changeset 6d479b506f0a614d42d75f1389dce6d911bcf492

Show
Ignore:
Timestamp:
21/08/07 19:15:51 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1187716551 +0000
git-parent:

[0ac8f78a85937b98141662c449bd0cd45af36689]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1187716551 +0000
Message:

Use hostname as SDP origin, as the spec says.
(Oh, I am well aware that this is often not correctly set, but then again,

why the heck would someone wants to parse the SDP origin in real life?)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/stream_output/sap.c

    r0e39834 r6d479b5  
    599599 
    600600     char *head = StartSDP (p_session->psz_name, p_session->description, 
    601         p_session->url, p_session->email, p_session->phone, b_ssm, 
     601        p_session->url, p_session->email, p_session->phone, 
    602602        (const struct sockaddr *)&p_session->orig, p_session->origlen, 
    603603        (const struct sockaddr *)&p_session->addr, p_session->addrlen); 
  • src/stream_output/sdp.c

    r74afcf6 r6d479b5  
    8888 
    8989char *StartSDP (const char *name, const char *description, const char *url, 
    90                 const char *email, const char *phone, vlc_bool_t ssm, 
    91                 const struct sockaddr *orig, socklen_t origlen, 
     90                const char *email, const char *phone, 
     91                const struct sockaddr *src, socklen_t srclen, 
    9292                const struct sockaddr *addr, socklen_t addrlen) 
    9393{ 
    94     uint64_t t = NTPtime64 (); 
    95     char *sdp, machine[MAXSDPADDRESS], conn[MAXSDPADDRESS], 
     94    uint64_t now = NTPtime64 (); 
     95    char *sdp; 
     96    char connection[MAXSDPADDRESS], hostname[256], 
    9697         sfilter[MAXSDPADDRESS + sizeof ("\r\na=source-filter: incl * ")]; 
    9798    const char *preurl = "\r\nu=", *premail = "\r\ne=", *prephone = "\r\np="; 
     99 
     100    gethostname (hostname, sizeof (hostname)); 
    98101 
    99102    if (name == NULL) 
     
    110113    if (!IsSDPString (name) || !IsSDPString (description) 
    111114     || !IsSDPString (url) || !IsSDPString (email) || !IsSDPString (phone) 
    112      || (AddressToSDP (orig, origlen, machine) == NULL) 
    113      || (AddressToSDP (addr, addrlen, conn) == NULL)) 
    114         return NULL; 
    115  
    116     if (ssm) 
    117         sprintf (sfilter, "\r\na=source-filter: incl IN IP%c * %s", 
    118                  machine[5], machine + 7); 
    119     else 
    120         *sfilter = '\0'; 
     115     || (AddressToSDP (addr, addrlen, connection) == NULL)) 
     116        return NULL; 
     117 
     118    strcpy (sfilter, ""); 
     119    if (srclen > 0) 
     120    { 
     121        char machine[MAXSDPADDRESS]; 
     122 
     123        if (AddressToSDP (src, srclen, machine) != NULL) 
     124            sprintf (sfilter, "\r\na=source-filter: incl IN IP%c * %s", 
     125                     machine[5], machine + 7); 
     126    } 
    121127 
    122128    if (asprintf (&sdp, "v=0" 
    123                     "\r\no=- "I64Fu" "I64Fu" %s" 
     129                    "\r\no=- "I64Fu" "I64Fu" IN IP%c %s" 
    124130                    "\r\ns=%s" 
    125131                    "\r\ni=%s" 
     
    139145                    "%s" // optional source filter 
    140146                    "\r\n", 
    141                /* o= */ t, t, machine, 
     147               /* o= */ now, now, connection[5], hostname, 
    142148               /* s= */ name, 
    143149               /* i= */ description, 
     
    145151               /* e= */ premail, email, 
    146152               /* p= */ prephone, phone, 
    147                /* c= */ conn
     153               /* c= */ connection
    148154    /* source-filter */ sfilter) == -1) 
    149155        return NULL; 
  • src/stream_output/stream_output.h

    r88148cb r6d479b5  
    119119 
    120120char *StartSDP (const char *name, const char *description, const char *url, 
    121                 const char *email, const char *phone, vlc_bool_t ssm, 
     121                const char *email, const char *phone, 
    122122                const struct sockaddr *orig, socklen_t origlen, 
    123123                const struct sockaddr *addr, socklen_t addrlen);