[vlc-devel] [PATCH] realrtsp pause seek

王波 silencewang at msn.com
Mon May 26 04:19:48 CEST 2008


about net_ReadNonBlock, i find the function in vlc-0.8.6's include/network.h,
when i find the function i am very very happy! yes, it is excellent!
but it is removed in new git version :(. i think it is not good idea, espcially
when i want to discard the incorrect network data which have buffered. :( 
if we don't discard the data, play timestamp will be wrong and demux/codec
maybe wrong. If we don't discard data here, we must discard the data in Demux module
by checking timestamp, but it is more complex ...
 
how about restore the function ? 
-- 
wangbo



> From: rdenis at simphalempin.com> To: vlc-devel at videolan.org> Date: Fri, 23 May 2008 17:03:38 +0300> Subject: Re: [vlc-devel] [PATCH] realrtsp pause seek> > Le Friday 23 May 2008 13:50:58 Wang Bo, vous avez écrit :> > @@ -120,6 +121,25 @@ static int RtspRead( void *p_userdata, uint8_t> > *p_buffer, int i_buffer ) return net_Read( p_access, p_sys->fd, 0,> > p_buffer, i_buffer, true ); }> >> > +static int RtspReadAndSkip( void * p_userdata )> > +{> > + access_t *p_access = (access_t *)p_userdata;> > + access_sys_t *p_sys = p_access->p_sys;> > + char buf[10240];> > + mtime_t time_wait = 500000;> > + int size, total=0;> > +> > + /*msg_Dbg( p_access, "Try RtspReadAndSkip ");*/> > + do {> > + size = net_ReadNonBlock( p_access, p_sys->fd, 0, buf, 10240, > > time_wait ); + /*if ( size > 0 ) buf[size] = 0;> > + msg_Dbg( p_access, "skip %d byte [0]%c [0] %d> > %s", size, buf[0], buf[0], buf);*/ + total += size;> > + }while( size > 0 );> > Usage of net_ReadNonBlock looks wrong here.> > > @@ -127,11 +147,19 @@ static int RtspReadLine( void *p_userdata, uint8_t> > *p_buffer, int i_buffer )> >> > char *psz = net_Gets( VLC_OBJECT(p_access), p_sys->fd, 0 );> >> > - //fprintf(stderr, "ReadLine: %s\n", psz);> > -> > - if( psz ) strncpy( (char *)p_buffer, psz, i_buffer );> > + if ( psz )> > + {> > + if( strlen( psz ) > i_buffer - 1 )> > + {> > + msg_Warn( p_access, "read data exceed the buffer size , simple> > skip some datas!"); + strncpy( (char *)p_buffer, psz +> > strlen(psz) - i_buffer + 10, i_buffer - 1 ); + }> > + else> > + strncpy( (char *)p_buffer, psz, i_buffer - 1 );> > + }> > else *p_buffer = 0;> >> > + p_buffer[ i_buffer -1 ] = '\0';> > Not sure if i_buffer can be zero here.> > > @@ -209,7 +238,8 @@ static int Open( vlc_object_t *p_this )> > psz_server = strdup("unknown");> > }> >> > - if( strstr( psz_server, "Real" ) || strstr( psz_server, "Helix" ) )> > + /* vatata is another rtsp/p2p streaming server which support real/rmvb> > streaming */ + if( strstr( psz_server, "Real" ) || strstr( psz_server,> > "Helix" )|| strstr( psz_server, "Vatata" ) ) {> > uint32_t bandwidth = 10485800;> > rmff_header_t *h;> > This does not belong in a pause patch.> > > + RtspReadAndSkip( p_access );> > + /* skip data which have sent to player, so next play will play the> > correct position */> > Probably not the right way to resync.> > > @@ -347,7 +423,9 @@ static int Control( access_t *p_access, int i_query,> > case ACCESS_SET_PAUSE_STATE:> > - /* Nothing to do */> > + pb_bool = (bool*)va_arg( args, bool* );> > + if ( ! pb_bool )> > + return Seek( p_access, p_access->info.i_pos );> > break;> > ACCESS_SET_PAUSE_STATE takes a bool, not a bool*.> > > @@ -337,7 +345,12 @@ int rtsp_request_describe( rtsp_client_t *rtsp, const> > char *what )> >> > int rtsp_request_setup( rtsp_client_t *rtsp, const char *what )> > {> > + if(! what )> > + {> > + return 500;> > + }> > Can this actually happen? If not, better assert().> > -- > Rémi Denis-Courmont> http://www.remlab.net/> _______________________________________________> vlc-devel mailing list> To unsubscribe or modify your subscription options:> http://mailman.videolan.org/listinfo/vlc-devel
_________________________________________________________________
Windows Live Photo gallery 数码相机的超级伴侣,轻松管理和编辑照片,还能制作全景美图!
http://get.live.cn/product/photo.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20080526/1fa96a03/attachment.html>


More information about the vlc-devel mailing list