[vlc-devel] [PATCH] Bug fix: Do not close an http stream when seeking past the EOF
Rémi Denis-Courmont
rdenis at simphalempin.com
Tue Jun 17 17:48:37 CEST 2008
Le mardi 17 juin 2008 01:08:24 Bill C. Riemers, vous avez écrit :
> + if( i_pos < 0 ) {
> + msg_Err( p_access, "seek to soon" );
> + i_pos = 0;
> + }
As has been discussed a few months ago, the access position really is
unsigned, and the file access plugins treat it as such. Hence there should be
no need to special case.
I know the (buggy) AVI demux sometimes seeks (or at least used to seek)
to "very large" negative offsets. The file access plugins cast the position
to unsigned, pending a later disruptive fix of the access_t.pf_seek
prototype. As such, they effectively seek to the end of the file.
> + if(p_access->info.i_size > 0 && i_pos >= p_access->info.i_size ) {
> + msg_Err( p_access, "seek to far" );
> + int retval = Seek( p_access, p_access->info.i_size - 1 );
> + if( retval == VLC_SUCCESS ) {
> + uint8_t p_buffer[2];
> + Read( p_access, p_buffer, 1);
> + p_access->info.b_eof = false;
> + }
> + return retval;
> + }
As far as I can tell, at (and beyond) end of file, b_eof should be set. It
should be reset to false only if the reader seeks backward. That's how both
file access plugins operate at the moment.
While this might seem to work for the AVI demux, it will break the input
stream code and screw up other demuxers. I believe the proper solution is
simply to reset b_eof to false in the Seek callback. Laurent should triple
check.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list