Commit 6d479b50 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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?)
parent 0ac8f78a
......@@ -598,7 +598,7 @@ static char *SDPGenerate( sap_handler_t *p_sap,
char *psz_group, *psz_name, *psz_sdp;
char *head = StartSDP (p_session->psz_name, p_session->description,
p_session->url, p_session->email, p_session->phone, b_ssm,
p_session->url, p_session->email, p_session->phone,
(const struct sockaddr *)&p_session->orig, p_session->origlen,
(const struct sockaddr *)&p_session->addr, p_session->addrlen);
if (head == NULL)
......
......@@ -87,15 +87,18 @@ static vlc_bool_t IsSDPString (const char *str)
char *StartSDP (const char *name, const char *description, const char *url,
const char *email, const char *phone, vlc_bool_t ssm,
const struct sockaddr *orig, socklen_t origlen,
const char *email, const char *phone,
const struct sockaddr *src, socklen_t srclen,
const struct sockaddr *addr, socklen_t addrlen)
{
uint64_t t = NTPtime64 ();
char *sdp, machine[MAXSDPADDRESS], conn[MAXSDPADDRESS],
uint64_t now = NTPtime64 ();
char *sdp;
char connection[MAXSDPADDRESS], hostname[256],
sfilter[MAXSDPADDRESS + sizeof ("\r\na=source-filter: incl * ")];
const char *preurl = "\r\nu=", *premail = "\r\ne=", *prephone = "\r\np=";
gethostname (hostname, sizeof (hostname));
if (name == NULL)
name = "Unnamed";
if (description == NULL)
......@@ -109,18 +112,21 @@ char *StartSDP (const char *name, const char *description, const char *url,
if (!IsSDPString (name) || !IsSDPString (description)
|| !IsSDPString (url) || !IsSDPString (email) || !IsSDPString (phone)
|| (AddressToSDP (orig, origlen, machine) == NULL)
|| (AddressToSDP (addr, addrlen, conn) == NULL))
|| (AddressToSDP (addr, addrlen, connection) == NULL))
return NULL;
if (ssm)
sprintf (sfilter, "\r\na=source-filter: incl IN IP%c * %s",
machine[5], machine + 7);
else
*sfilter = '\0';
strcpy (sfilter, "");
if (srclen > 0)
{
char machine[MAXSDPADDRESS];
if (AddressToSDP (src, srclen, machine) != NULL)
sprintf (sfilter, "\r\na=source-filter: incl IN IP%c * %s",
machine[5], machine + 7);
}
if (asprintf (&sdp, "v=0"
"\r\no=- "I64Fu" "I64Fu" %s"
"\r\no=- "I64Fu" "I64Fu" IN IP%c %s"
"\r\ns=%s"
"\r\ni=%s"
"%s%s" // optional URL
......@@ -138,13 +144,13 @@ char *StartSDP (const char *name, const char *description, const char *url,
"\r\na=charset:UTF-8"
"%s" // optional source filter
"\r\n",
/* o= */ t, t, machine,
/* o= */ now, now, connection[5], hostname,
/* s= */ name,
/* i= */ description,
/* u= */ preurl, url,
/* e= */ premail, email,
/* p= */ prephone, phone,
/* c= */ conn,
/* c= */ connection,
/* source-filter */ sfilter) == -1)
return NULL;
return sdp;
......
......@@ -118,7 +118,7 @@ void announce_SAPHandlerDestroy( sap_handler_t *p_sap );
#include <stdarg.h>
char *StartSDP (const char *name, const char *description, const char *url,
const char *email, const char *phone, vlc_bool_t ssm,
const char *email, const char *phone,
const struct sockaddr *orig, socklen_t origlen,
const struct sockaddr *addr, socklen_t addrlen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment