[MPlayer-cvslog] r31201 - trunk/stream/cache2.c
Ivan Kalvachev
ikalvachev at gmail.com
Tue May 25 01:29:15 CEST 2010
On 5/24/10, Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
> On Mon, May 24, 2010 at 05:38:50PM +0300, Ivan Kalvachev wrote:
>> Reimar, while you are working on cache2.c I'd like to make a feature
>> request.
>>
>> Could you try to find some workaround for the known problem with eof
>> handling. For networks streams if playback is paused, server may
>> disconnect the connection and cache would fail to resume, thinking it
>> have reached the eof. Same thing happens with local files that are
>> still growing.
>>
>> The way I see it is by implementing EOF in 3 states.
>> 0 - eof not reached
>> 1 - eof reached, cache full.
>> 2 - eof reached, cache empty, resume failed.
>
> Do you have a nice test case?
> I suspect you might be overcomplicating things, and something liek below
I assumed that once eof is reached cache_fill() won't be doing any new
reads in order to avoid unneeded OS overhead. However I can't spot the
code that does that.
Also, a known workaround to resume broken/timeout-ed http is to
perform long_seek. Performing long seek on network server every 10ms
won't be pretty ;)
> might work (I suspect it will not be enough, the eof handling is wildly
> spread all over the place, probably left-overs from half-failed attempts
> to fix various issues).
> Index: stream/cache2.c
> ===================================================================
> --- stream/cache2.c (revision 31207)
> +++ stream/cache2.c (working copy)
> @@ -225,7 +225,7 @@
> //memcpy(&s->buffer[pos],s->stream->buffer,len); // avoid this extra
> copy!
> // ....
> len=stream_read(s->stream,&s->buffer[pos],space);
> - if(!len) s->eof=1;
> + s->eof=!len;
>
> s->max_filepos+=len;
> if(pos+len>=s->buffer_size){
Looking at the code this should work (at least for local file).
When I tried it, there was no change.
More information about the MPlayer-cvslog
mailing list