[Live-devel] DeviceSource

Jan Herling Jan.Herling at fit.fraunhofer.de
Mon Feb 21 03:07:05 PST 2005


Hallo,

I would like to write a DirectShow RTSPServerFilter so that I can stream 
live capture videos from my
application on other computers in my network.

So I build a filter graph with the these filters:
- source filter (for source frame grabbing)
- mpeg4 encoder (to get the encoded mpeg4 stream)
- rtsp server filter (to send the stream over the network)

I wrote my own media subsession class:
Most code I took from the MPEG4VideoFileServerMediaSubsession
MPEG4VideoLiveServerMediaSubsession : public OnDemandServerMediaSubsession
{
.....
}

I wrote my own DeviceSource class (like you discribed it in the faq  - 
liveMedia/DeviceSource.cpp):
MPEG4LiveSource : public FramedSource
{

void MPEG4LiveSource::doGetNextFrame()
{
   // pop the oldest mpeg4 stream sample from the buffer stack
   // copy it into fTo, copy max. fMaxSize bytes
   // returns the real copied buffer size
   fFrameSize = mParent->popBuffer(fTo, fMaxSize);

   // set the presentation time to the current time because this is a 
live stream
   gettimeofday(&fPresentationTime, NULL);     // use 25 frames per 
second because the live stream use it too
   fDurationInMicroseconds = 1000000 / 25;

  nextTask() = envir().taskScheduler().scheduleDelayedTask(0,
               (TaskFunc*)FramedSource::afterGetting, this)
}

.....
}

Now my problem:
I get a delay of  perhaps 30 seconds. This means:
The live captured video arrived 30 seconds later on the client computer 
in my network.
Although the network shows a constant traffic (controled with Windows 
Task-Manager)
I'm using the VLC player on the client computer.


I have no parsing functions in my code to parse the mpeg4 stream.
Is this necessary though I have a live stream?
And if so, what have I to parse?

I changed the fPresentationTime and fDurationInMicroseconds to any 
values but this produced no changes.

I also wrote my mpeg4 stream into a file and stream this file with the 
"testOnDemandRTSPServer" example.
This produced a perfect stream.

And last: This can not be a performance problem or a firewall problem.

Does anyone see where the problem in my code is?

Thank you very much for helping me !!!!!

Best regards

Jan Herling



More information about the live-devel mailing list