[Live-devel] RTSPClient: how to end eventloop AFTER file is written to disk

Sven Wasmer sven.wasmer at gmail.com
Thu Mar 11 07:33:45 PST 2010


Hello Ross, hello everbody else there,

Well, I'm currently trying to get through the RTSPClient lib and mixing it up with some objC.
Thus we get a nice meal called: obj-C++ :-)

My current aim is to fetch a h264-stream from a server and write it to a file on the client-side.
this works so far.
I'm available to:
- get an SDPDescription from the server
- create my basicUsageEnivironment with that description
- creating a Filesink for h264
- writing to a file ...

... but:
after a final call to env->taskScheduler().doEventLoop(); this leads obviously to an infinity loop ... 
which I want to end, after all data is received and written to file.


therefore I tried some solutions from older postings in this list using the "watcherVariable", especially the one introducing
a modified "dummyTask" where I point to a global visible watchVariable:


void dummyTask(UsageEnvironment* env, char* myWatchVariable) {
		
	// Call this again, after a brief delay:
	int uSecsToDelay = 1000000; //
	
	//*env->taskScheduler().scheduleDelayedTask(uSecsToDelay,(TaskFunc*)dummyTask, NULL);
	env->taskScheduler().scheduleDelayedTask(uSecsToDelay, (TaskFunc*)dummyTask, NULL);
	
	NSLog(@"dummyTask called :-) ... waiting a second\n"); //"printf" in objC
	
	
	//setting watchVariable to "NULL" -> EventLoop will end!
	myWatchVariable = '\0';

}



my problem is, that my stream will not get written to the file, as the eventloop will be finished before this could be done, in fact zero bytes are written, only the filename ist created/updated.


So my question:
How can I get the eventLoop to end AFTER my file is written (seems the buffer needs to be checked or something else)?
Do I have to setup "BasicTaskScheduler::turnOnBackgroundReadHandling" for this?


Any help would be great :-)

cheers
Sven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20100311/4b55569b/attachment-0001.html>


More information about the live-devel mailing list