[Live-devel] Limiting frame rate for a source
Jan Ekholm
jan.ekholm at d-pointer.com
Tue Apr 22 11:30:40 PDT 2014
On 22 apr 2014, at 19:01, Jan Ekholm <jan.ekholm at d-pointer.com> wrote:
>
>>> 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.
>
> Yes, that happens for the H264 source, but not for the MJPEG one. I have reuseFirstSource set to true as
> the camera can only be opened once. I will have to dig deeper so see why the MJPEG source does not stop.
> Both OnDemandServerMediaSubsession are very similar, apart from the H264 one having the extra dummy
> sink to get the aux data.
I don't see any of my destructors called for any of my subclasses when I disconnect my client. However,
when the client initially connects there is a somewhat strange sequence of calls. First there are the
expected calls:
createNewStreamSource()
createNewRTPSink()
to my OnDemandServerMediaSubsession subclass. These set up a JPEGVideoSource subclass
and a standard JPEGVideoRTPSink. Immediately after this the destructor for my JPEGVideoSource
is called and the source is cleaned up. After this I again get:
createNewStreamSource()
createNewRTPSink()
and now the streaming starts and never stops. Is it possible to enable some kind of debugging
output for Live555? I suspect that the somewhat interesting reference counting is somehow to
blame, i.e. that I perhaps don't understand it at all and cause my objects to be immortal.
--
Jan Ekholm
jan.ekholm at d-pointer.com
More information about the live-devel
mailing list