[Live-devel] Server doesn't interleave reads from pipe and sending packets?
Cristiano Belloni
belloni at imavis.com
Thu Jan 17 00:44:46 PST 2008
Ross Finlayson wrote:
> First, you should make sure that if the same data is stored in a
> regular file - rather than on a FIFO - then you can stream it OK.
> This will help ensure that you don't have problems with bad
> timestamps in your data.
>
I can.
> Second, when you read from a FIFO, you must make sure that reads from
> the FIFO are *asynchronous* - i.e., non-blocking, and handled within
> the event loop.
The library handles this: The server is very simple:
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
env = BasicUsageEnvironment::createNew(*scheduler);
RTSPServer* rtspServer = RTSPServer::createNew(*env, 554, authDB, 45);
[..]
H263plusVideoFileServerMediaSubsession* mss =
H263plusVideoFileServerMediaSubsession::createNew(*env, inputFileName,
reuseFirstSource);
sms->addSubsession(mss);
rtspServer->addServerMediaSession(sms);
}
env->taskScheduler().doEventLoop();
I omitted the variable initizations; inputFileName is obviously filename
of the FIFO. And, yes, I set reuseFirstSource to true.
> If the read end of your FIFO - as seen from your
> server - is a normal open file, then this should happen
> automatically, *unless* you are running Windows. (Windows is
> brain-damaged, and doesn't always treat open files as being
> select()able sockets, so reads on open files in Windows are
> synchronous by default.)
>
Nope, I'm running Linux.
> Apart from this, because you're working with your own custom code,
> there's not a whole lot more I can suggest.
>
Do you see any errors in the server code I posted?
Thanks,
Cristiano.
--
Belloni Cristiano
Imavis Srl.
www.imavis.com <http://www.imavis.com>
belloni at imavis.com <mailto://belloni@imavis.com>
More information about the live-devel
mailing list