[Live-devel] some problems with ByteStreamMultiFileSource

Karlov Andrey kan at pisem.net
Mon Sep 10 02:01:51 PDT 2007


but we haven't! in first mail I have explained why.

This is because we check for EOF only before reading!

Then we read next time, we before check for EOF,
but there's no EOF state and we try to read,
and of course we read 0 bytes, but now we have EOF state =)


and it's handled not here, as it should be:

    void ByteStreamFileSource::doGetNextFrame() {
        if (feof(fFid) || ferror(fFid)) {
        handleClosure(this);  <--- SWITCH TO NEXT FILE
        return;
        }
     ....


but here:

void MPEG2TransportStreamFramer::afterGettingFrame1(unsigned frameSize,
                            struct timeval presentationTime) {
      fFrameSize += frameSize;
      unsigned const numTSPackets = fFrameSize/TRANSPORT_PACKET_SIZE;
      fFrameSize = numTSPackets*TRANSPORT_PACKET_SIZE;
      if (fFrameSize == 0) {
        // We didn't read a complete TS packet;
        //assume that the input source has closed.
        handleClosure(this); <-- EXIT FROM PROGRAM,
				NO SWITCH TO ANOTHER FILE
        return;
      }
    ......






 >>\For example I have file with size 6011488 bytes.
 >>6011488 = 4568*1316=4568*(7*188) <--it's correct transport stream >file,
 >>but then we read last portion of this file:
 >>	fFrameSize = fread(fTo, 1, fMaxSize, fFid);
 >>we read exactly 1316 bytes, the file is no longer left bytes!!!
 >>but also we haven't EOF state,
 >
 >In that case, you should get EOF on the file the next time you try to
 >read from it.
 >--


More information about the live-devel mailing list