[Live-devel] Limiting frame rate for a source
Ross Finlayson
finlayson at live555.com
Tue Apr 22 08:28:24 PDT 2014
> I have a USB camera that I can stream as MJPEG using a JPEGVideoSource subclass.
> It all works nicely and the frames are streamed and received ok. I would however like
> to be able to limit the frame rate of the stream, as it now seems to be 20+ fps. In this
> case it's way too high as the use case is a surveillance camera that grabs a big overview
> image, not video conferencing. I tried looking at the FAQ and the examples but didn't
> see anything.
I'm not sure I understand your question. You have written your own media source class (in this case, a subclass of "JPEGVideoSource") that delivers encoded (JPEG) frames. You want to reduce its frame rate - i.e., how soon it calls "FramedSource::afterGetting()" in response to each call to "doGetNextFrame()". So just do it. This is your code :-)
> Also, is there some way to know when all clients have disconnected from a RTSP source
> so that I could stop grabbing and encoding frames?
This should happen automatically. I.e., when the last concurrent RTSP client has disconnected (or timed out), then your media source class's destructor will get called. Therefore, you should write your media source class's destructor so that it stops grabbing/encoding.
Don't forget to have your subclass of "OnDemandServerMediaSubsession" set the "reuseFirstSource" parameter to True when it calls the "OnDemandServerMediaSubsession" constructor. This will ensure that no more than one instance of your media source class will ever be created concurrently, regardless of the number of concurrent RTSP clients.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140422/75cbdf86/attachment.html>
More information about the live-devel
mailing list