Commit 02859f76 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Repair SAP + SSM

parent fe1670bd
......@@ -321,7 +321,6 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
ipv4 = 0xe0027ffe;
}
/* FIXME FIXME FIXME */
if( ipv4 == 0 )
{
msg_Err( p_sap, "Out-of-scope multicast address "
......@@ -600,7 +599,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,
p_session->url, p_session->email, p_session->phone, b_ssm,
(const struct sockaddr *)&p_session->orig, p_session->origlen,
(const struct sockaddr *)&p_session->addr, p_session->addrlen);
if (head == NULL)
......@@ -614,32 +613,20 @@ static char *SDPGenerate( sap_handler_t *p_sap,
|| (asprintf (&plgroup, "a=x-plgroup:%s\r\n", psz_group) == -1))
plgroup = NULL;
char *sfilter;
#if 0
if ((!b_ssm)
|| (asprintf (&sfilter, "a=source-filter: incl IN IP%c * %s\r\n",
ipv, p_addr->psz_machine) == -1))
#else
# warning FIXME: repair Source Specific Multicast
#endif
sfilter = NULL;
const char *comedia = NULL;
if (!strncasecmp (p_session->sdpformat, "DCCP", 4)
|| !strncasecmp (p_session->sdpformat, "TCP", 3))
comedia = "a=setup:passive\r\n"
"a=connection:new\r\n";
int res = asprintf (&psz_sdp, "%s" "%s" "%s" "%s"
int res = asprintf (&psz_sdp, "%s" "%s" "%s"
"m=video %d %s\r\n",
head,
plgroup ?: "",
sfilter ?: "",
comedia ?: "",
net_GetPort ((const struct sockaddr *)&p_session->addr),
p_session->sdpformat);
free (plgroup);
free (sfilter);
if (res == -1)
return NULL;
......
......@@ -85,12 +85,13 @@ 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,
const char *email, const char *phone, vlc_bool_t ssm,
const struct sockaddr *orig, socklen_t origlen,
const struct sockaddr *addr, socklen_t addrlen)
{
uint64_t t = NTPtime64 ();
char *sdp, machine[MAXSDPADDRESS], conn[MAXSDPADDRESS];
char *sdp, machine[MAXSDPADDRESS], conn[MAXSDPADDRESS],
sfilter[MAXSDPADDRESS + sizeof ("\r\na=source-filter: incl * ")];
const char *preurl = "\r\nu=", *premail = "\r\ne=", *prephone = "\r\np=";
if (name == NULL)
......@@ -110,6 +111,12 @@ char *StartSDP (const char *name, const char *description, const char *url,
|| (AddressToSDP ((struct sockaddr *)addr, addrlen, conn) == NULL))
return NULL;
if (ssm)
sprintf (sfilter, "\r\na=source-filter: incl IN IP%c * %s",
machine[5], machine + 7);
else
*sfilter = '\0';
if (asprintf (&sdp, "v=0"
"\r\no=- "I64Fu" "I64Fu" %s"
"\r\ns=%s"
......@@ -127,6 +134,7 @@ char *StartSDP (const char *name, const char *description, const char *url,
"\r\na=recvonly"
"\r\na=type:broadcast"
"\r\na=charset:UTF-8"
"%s" // optional source filter
"\r\n",
/* o= */ t, t, machine,
/* s= */ name,
......@@ -134,7 +142,8 @@ char *StartSDP (const char *name, const char *description, const char *url,
/* u= */ preurl, url,
/* e= */ premail, email,
/* p= */ prephone, phone,
/* c= */ conn) == -1)
/* c= */ conn,
/* source-filter */ sfilter) == -1)
return NULL;
return sdp;
}
......
......@@ -111,7 +111,7 @@ sap_handler_t *announce_SAPHandlerCreate( announce_handler_t *p_announce );
void announce_SAPHandlerDestroy( sap_handler_t *p_sap );
char *StartSDP (const char *name, const char *description, const char *url,
const char *email, const char *phone,
const char *email, const char *phone, vlc_bool_t ssm,
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