[vlc-devel] suggestion of modifications of 2.0.5 code for playing stream
Rémi Denis-Courmont
remi at remlab.net
Fri May 24 10:48:10 CEST 2013
On Sun, 19 May 2013 00:53:48 +0100 (BST), julien de ROSNY <m8hpw at yahoo.fr>
wrote:
> The first modification is at line 550 of httplive.c file where
> char *path_end = strrchr(psz_url, '/');
> is replaced by
> char *path_end;
> if (psz_path[0]=='/')
> {
> //If the psz path contains all the subpaths and the file name but
not
> the URL
This comment does not make much sense to me.
> path_end = strstr(psz_url,"//");
> path_end = strchr(path_end+2, '/')-1;
This can crash. It looks rather naive if it's a way to deal with relative
URLs.
> }
> else
> {
> //If the psz path only contains the file name
> path_end = strrchr(psz_url, '/');
> }
>
> because otherwise the subpath after the main internet adress was
repeated
> twice.
In general, it's a known bug that VLC fails to resolve relative URLs
correctly :-( This is not specific to HLS.
(...)
> Now in file http.c
> In function "cookie_get_domain"
> I changed (line 1681)
> if( !strncmp( str, domain, sizeof(domain) - 1 /* minus \0 */ ) )
> into
> if( !strncasemp( str, domain, sizeof(domain) - 1 /* minus \0 */ ) )
>
> because in order to be case insensitive. Indeed for my application, the
> served send "Domain = " instead of "domain="
AFAIK, the specification (IETF RFC 6265) requires "Domain=", not
"domain=".
> In http.c function Open
> I add
> vlc_array_t *p_jar;
> p_jar = (vlc_array_t *)var_GetAddress( p_this->p_libvlc,
> "http-cookie-jar" );
> if ( p_jar == NULL )
> {
> p_jar = (vlc_array_t *) vlc_array_new();
> var_Create( p_this->p_libvlc, "http-cookie-jar", VLC_VAR_ADDRESS
> );
> var_SetAddress( p_this->p_libvlc, "http-cookie-jar", p_jar );
> }
> return OpenWithCookies( p_this, p_access->psz_access, 5, p_jar );
This won't work. It's not thread-safe in several ways. And it will leak
with each LibVLC instance.
> But with this approach I think the cookie array is never destroyed.
Indeed.
> Should I destroyed it in libvlc_InternalCleanup function or not?
No, that would still not be thread-safe. Furthermore, I am not sure the
LibVLC instance makes the most appropriate storage scope for session
cookies.
> More generally do you think the code is ok to be added to vlc?
URL resolution should be corrected, and cookies support improved. But the
code can not be added in its current form.
--
Rémi Denis-Courmont
Sent from my collocated server
More information about the vlc-devel
mailing list