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

Remove dead code

parent 974be97b
...@@ -54,32 +54,7 @@ struct announce_method_t ...@@ -54,32 +54,7 @@ struct announce_method_t
static session_descriptor_t * sout_AnnounceSessionCreate (vlc_object_t *obj, static session_descriptor_t * sout_AnnounceSessionCreate (vlc_object_t *obj,
const char *cfgpref) const char *cfgpref)
{ {
size_t cfglen = strlen (cfgpref); return calloc (1, sizeof (session_descriptor_t));
if (cfglen > 100)
return NULL;
char varname[cfglen + sizeof ("description")], *subvar = varname + cfglen;
strcpy (varname, cfgpref);
session_descriptor_t *p_session = calloc (1, sizeof (*p_session));
if (p_session == NULL)
return NULL;
strcpy (subvar, "name");
p_session->psz_name = var_GetNonEmptyString (obj, varname);
strcpy (subvar, "group");
p_session->psz_group = var_GetNonEmptyString (obj, varname);
strcpy (subvar, "description");
p_session->description = var_GetNonEmptyString (obj, varname);
strcpy (subvar, "url");
p_session->url = var_GetNonEmptyString (obj, varname);
strcpy (subvar, "email");
p_session->email = var_GetNonEmptyString (obj, varname);
strcpy (subvar, "phone");
p_session->phone = var_GetNonEmptyString (obj, varname);
return p_session;
} }
/** /**
...@@ -167,18 +142,7 @@ int sout_AnnounceUnRegister( sout_instance_t *p_sout, ...@@ -167,18 +142,7 @@ int sout_AnnounceUnRegister( sout_instance_t *p_sout,
*/ */
void sout_AnnounceSessionDestroy( session_descriptor_t *p_session ) void sout_AnnounceSessionDestroy( session_descriptor_t *p_session )
{ {
if( p_session ) free( p_session );
{
free (p_session->psz_name);
free (p_session->psz_group);
free (p_session->psz_sdp);
free (p_session->description);
free (p_session->sdpformat);
free (p_session->url);
free (p_session->email);
free (p_session->phone);
free( p_session );
}
} }
/** /**
......
...@@ -90,9 +90,6 @@ struct sap_session_t { ...@@ -90,9 +90,6 @@ struct sap_session_t {
*****************************************************************************/ *****************************************************************************/
static void RunThread( vlc_object_t *p_this); static void RunThread( vlc_object_t *p_this);
static int ComputeRate( sap_address_t *p_address ); static int ComputeRate( sap_address_t *p_address );
static char *SDPGenerate( sap_handler_t *p_sap,
const session_descriptor_t *p_session,
vlc_bool_t b_ssm );
static int announce_SendSAPAnnounce( sap_handler_t *p_sap, static int announce_SendSAPAnnounce( sap_handler_t *p_sap,
sap_session_t *p_session ); sap_session_t *p_session );
...@@ -419,9 +416,8 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap, ...@@ -419,9 +416,8 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
p_sap_session->p_address = p_address; p_sap_session->p_address = p_address;
} }
if (p_session->origlen == 0) memcpy (&p_session->orig, &p_sap_session->p_address->orig,
memcpy (&p_session->orig, &p_sap_session->p_address->orig, p_session->origlen = p_sap_session->p_address->origlen);
p_session->origlen = p_sap_session->p_address->origlen);
size_t headsize = 20; size_t headsize = 20;
switch (p_session->orig.ss_family) switch (p_session->orig.ss_family)
...@@ -442,15 +438,7 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap, ...@@ -442,15 +438,7 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
} }
/* If needed, build the SDP */ /* If needed, build the SDP */
if( p_session->psz_sdp == NULL ) assert( p_session->psz_sdp != NULL );
{
p_session->psz_sdp = SDPGenerate( p_sap, p_session, b_ssm );
if( p_session->psz_sdp == NULL )
{
vlc_mutex_unlock( &p_sap->object_lock );
return VLC_ENOMEM;
}
}
p_sap_session->i_last = 0; p_sap_session->i_last = 0;
p_sap_session->i_length = headsize + strlen (p_session->psz_sdp); p_sap_session->i_length = headsize + strlen (p_session->psz_sdp);
...@@ -587,50 +575,6 @@ static int announce_SendSAPAnnounce( sap_handler_t *p_sap, ...@@ -587,50 +575,6 @@ static int announce_SendSAPAnnounce( sap_handler_t *p_sap,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static char *SDPGenerate( sap_handler_t *p_sap,
const session_descriptor_t *p_session,
vlc_bool_t b_ssm )
{
char *psz_group, *psz_name, *psz_sdp;
char *head = sdp_Start (p_session->psz_name, p_session->description,
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)
return NULL;
psz_group = p_session->psz_group;
psz_name = p_session->psz_name;
char *plgroup;
if ((psz_group == NULL)
|| (asprintf (&plgroup, "a=x-plgroup:%s\r\n", psz_group) == -1))
plgroup = 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"
"m=video %d %s\r\n",
head,
plgroup ?: "",
comedia ?: "",
ntohs (net_GetPort ((const struct sockaddr *)&p_session->addr)),
p_session->sdpformat);
free (plgroup);
if (res == -1)
return NULL;
msg_Dbg( p_sap, "Generated SDP (%u bytes):\n%s",
(unsigned)strlen(psz_sdp), psz_sdp );
return psz_sdp;
}
static int ComputeRate( sap_address_t *p_address ) static int ComputeRate( sap_address_t *p_address )
{ {
uint8_t buffer[SAP_MAX_BUFFER]; uint8_t buffer[SAP_MAX_BUFFER];
......
...@@ -75,20 +75,11 @@ struct sap_handler_t ...@@ -75,20 +75,11 @@ struct sap_handler_t
struct session_descriptor_t struct session_descriptor_t
{ {
char *psz_name;
char *psz_group;
char *description;
char *url; // meta URL for SAP, potentially real URL for other cases
char *email;
char *phone;
struct sockaddr_storage orig; struct sockaddr_storage orig;
socklen_t origlen; socklen_t origlen;
struct sockaddr_storage addr; struct sockaddr_storage addr;
socklen_t addrlen; socklen_t addrlen;
char *sdpformat; // format suitable for SDP
char *psz_sdp; char *psz_sdp;
vlc_bool_t b_ssm; vlc_bool_t b_ssm;
}; };
......
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