<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 9pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>about net_ReadNonBlock, i find the function in vlc-0.8.6's include/network.h,<BR>
when i find the function i am very very happy! yes, it is excellent!<BR>
but it is removed in new git version :(. i think it is not good idea, espcially<BR>
when i want to discard the incorrect network data which have buffered. :( <BR>
if we don't discard the data, play timestamp will be wrong and demux/codec<BR>
maybe wrong. If we don't discard data here, we must discard the data in Demux module<BR>
by checking timestamp, but it is more complex ...<BR>
 <BR>
how about restore the function ? <BR>
<BR>-- <BR>
wangbo<BR><BR><BR><BR>

<HR id=stopSpelling>
<BR>
> From: rdenis@simphalempin.com<BR>> To: vlc-devel@videolan.org<BR>> Date: Fri, 23 May 2008 17:03:38 +0300<BR>> Subject: Re: [vlc-devel] [PATCH] realrtsp pause seek<BR>> <BR>> Le Friday 23 May 2008 13:50:58 Wang Bo, vous avez écrit :<BR>> > @@ -120,6 +121,25 @@ static int RtspRead( void *p_userdata, uint8_t<BR>> > *p_buffer, int i_buffer ) return net_Read( p_access, p_sys->fd, 0,<BR>> > p_buffer, i_buffer, true ); }<BR>> ><BR>> > +static int RtspReadAndSkip( void * p_userdata )<BR>> > +{<BR>> > + access_t *p_access = (access_t *)p_userdata;<BR>> > + access_sys_t *p_sys = p_access->p_sys;<BR>> > + char buf[10240];<BR>> > + mtime_t time_wait = 500000;<BR>> > + int size, total=0;<BR>> > +<BR>> > + /*msg_Dbg( p_access, "Try RtspReadAndSkip ");*/<BR>> > + do {<BR>> > + size = net_ReadNonBlock( p_access, p_sys->fd, 0, buf, 10240, <BR>> > time_wait ); + /*if ( size > 0 ) buf[size] = 0;<BR>> > + msg_Dbg( p_access, "skip %d byte [0]%c [0] %d<BR>> > %s", size, buf[0], buf[0], buf);*/ + total += size;<BR>> > + }while( size > 0 );<BR>> <BR>> Usage of net_ReadNonBlock looks wrong here.<BR>> <BR>> > @@ -127,11 +147,19 @@ static int RtspReadLine( void *p_userdata, uint8_t<BR>> > *p_buffer, int i_buffer )<BR>> ><BR>> > char *psz = net_Gets( VLC_OBJECT(p_access), p_sys->fd, 0 );<BR>> ><BR>> > - //fprintf(stderr, "ReadLine: %s\n", psz);<BR>> > -<BR>> > - if( psz ) strncpy( (char *)p_buffer, psz, i_buffer );<BR>> > + if ( psz )<BR>> > + {<BR>> > + if( strlen( psz ) > i_buffer - 1 )<BR>> > + {<BR>> > + msg_Warn( p_access, "read data exceed the buffer size , simple<BR>> > skip some datas!"); + strncpy( (char *)p_buffer, psz +<BR>> > strlen(psz) - i_buffer + 10, i_buffer - 1 ); + }<BR>> > + else<BR>> > + strncpy( (char *)p_buffer, psz, i_buffer - 1 );<BR>> > + }<BR>> > else *p_buffer = 0;<BR>> ><BR>> > + p_buffer[ i_buffer -1 ] = '\0';<BR>> <BR>> Not sure if i_buffer can be zero here.<BR>> <BR>> > @@ -209,7 +238,8 @@ static int Open( vlc_object_t *p_this )<BR>> > psz_server = strdup("unknown");<BR>> > }<BR>> ><BR>> > - if( strstr( psz_server, "Real" ) || strstr( psz_server, "Helix" ) )<BR>> > + /* vatata is another rtsp/p2p streaming server which support real/rmvb<BR>> > streaming */ + if( strstr( psz_server, "Real" ) || strstr( psz_server,<BR>> > "Helix" )|| strstr( psz_server, "Vatata" ) ) {<BR>> > uint32_t bandwidth = 10485800;<BR>> > rmff_header_t *h;<BR>> <BR>> This does not belong in a pause patch.<BR>> <BR>> > + RtspReadAndSkip( p_access );<BR>> > + /* skip data which have sent to player, so next play will play the<BR>> > correct position */<BR>> <BR>> Probably not the right way to resync.<BR>> <BR>> > @@ -347,7 +423,9 @@ static int Control( access_t *p_access, int i_query,<BR>> > case ACCESS_SET_PAUSE_STATE:<BR>> > - /* Nothing to do */<BR>> > + pb_bool = (bool*)va_arg( args, bool* );<BR>> > + if ( ! pb_bool )<BR>> > + return Seek( p_access, p_access->info.i_pos );<BR>> > break;<BR>> <BR>> ACCESS_SET_PAUSE_STATE takes a bool, not a bool*.<BR>> <BR>> > @@ -337,7 +345,12 @@ int rtsp_request_describe( rtsp_client_t *rtsp, const<BR>> > char *what )<BR>> ><BR>> > int rtsp_request_setup( rtsp_client_t *rtsp, const char *what )<BR>> > {<BR>> > + if(! what )<BR>> > + {<BR>> > + return 500;<BR>> > + }<BR>> <BR>> Can this actually happen? If not, better assert().<BR>> <BR>> -- <BR>> Rémi Denis-Courmont<BR>> http://www.remlab.net/<BR>> _______________________________________________<BR>> vlc-devel mailing list<BR>> To unsubscribe or modify your subscription options:<BR>> http://mailman.videolan.org/listinfo/vlc-devel<BR><BR><br /><hr />使用新一代 Windows Live Messenger 轻松交流和共享! <a href='http://messenger.live.cn/' target='_new'>立即体验!</a></body>
</html>