[vlc-commits] sap: factor the well-known PT check
Rémi Denis-Courmont
git at videolan.org
Fri Apr 10 12:18:26 CEST 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 10 13:11:59 2020 +0300| [613e307b37abf430c9e6211a80000d1f056700c8] | committer: Rémi Denis-Courmont
sap: factor the well-known PT check
It was called right after ParseConnection() in both cases.
Move it inside ParseConnection().
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=613e307b37abf430c9e6211a80000d1f056700c8
---
modules/services_discovery/sap.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 232b0d448b..c028fd6753 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -368,10 +368,8 @@ static int OpenDemux( vlc_object_t *p_this )
if( ParseConnection( VLC_OBJECT( p_demux ), p_sdp ) )
{
p_sdp->psz_uri = NULL;
- }
- if (!IsWellKnownPayload (p_sdp->i_media_type))
goto error;
- if( p_sdp->psz_uri == NULL ) goto error;
+ }
demux_sys_t *p_sys = malloc( sizeof(*p_sys) );
if( unlikely(p_sys == NULL) )
@@ -749,7 +747,7 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
p_sdp->psz_uri = NULL;
/* Multi-media or no-parse -> pass to LIVE.COM */
- if( !IsWellKnownPayload( p_sdp->i_media_type ) || !p_sys->b_parse )
+ if( !p_sys->b_parse )
{
free( p_sdp->psz_uri );
if (asprintf( &p_sdp->psz_uri, "sdp://%s", p_sdp->psz_sdp ) == -1)
@@ -1083,6 +1081,12 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
return VLC_ENOMEM;
}
+ if (!IsWellKnownPayload(p_sdp->i_media_type))
+ {
+ free(p_sdp->psz_uri);
+ return VLC_EGENERIC;
+ }
+
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list