- /* Some broken stream may lack the first boundary */
- if ( p_sys->psz_separator == NULL )
- {
- msg_Warn( p_demux, "Malformed stream. Trying to work around");
- char *content_type = stream_ContentType( p_demux->s );
- if ( content_type == NULL )
- return false;
- const char* boundary = strstr( content_type, "boundary=--" );
- if ( boundary != NULL )
- {
- p_sys->psz_separator = strdup( boundary + strlen( "boundary=--" ) );
- msg_Dbg( p_demux, "Video boundary extracted from Content-Type: %s", p_sys->psz_separator );
- free( content_type );
- /* Skip to HTTP header parsing as there's no boundary to extract
- * from the stream */
- }
- else
- {
- free( content_type );
- return false;
- }
- }
- else
- {
- *p_header_size = 0;
- return false;
- }