Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: mplex and mpegtools 2gb limit



> Both times when it reaches the end of the TS file, and looks 
> like it has
> completed vid and aud, it hangs.. in exactly the same way 
> dvb-mplex hangs
> with:
> # dvb-mplex -t MPEG2 -o test.mpg -i TS_STREAM 
> DVB-9-20021127-2059.36+2h10m.ts
> 
> 
> read(3, "", 1880)                       = 0
> read(3, "", 1880)                       = 0
> read(3, "", 1880)                       = 0
> 
> ... repeats for ever.. Why is it continuing to read from this 
> file.. the
> return value of 0 indicated EOF surely?

Looking at the code, dvb-mpegtools differs in that it uses save_read()
instead of read(), but the function has a slight flaw that won't let it
exit the read() loop:

ssize_t save_read(int fd, void *buf, size_t count)
{
        ssize_t neof = 1;
        size_t re = 0;

        while(neof >= 0 && re < count){
                neof = read(fd, buf+re, count - re);
                if (neof > 0) re += neof;
        }

        if (neof < 0 && re == 0) return neof;
        else return re;
}

The while() statement should be (while neof > 0 && re < count),
otherwise when it *is* EOF (which it would be on the very last pass of
this function) it will never exit (i.e. read returns 0 so while(0 is >=
0 && 0 < count));

I modified and recompiled and mine now exits at EOF.

Andy.






-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index