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