Hi, I don't think I'm handling multiple client connections properly in my camera's live rtsp server.
My camera has multiple streams and I derive a class from FramedSource for each of my substreams, the constructor looks like this:- StreamSource::StreamSource(UsageEnvironment &env,streamSubStream_t *substream) : FramedSource(env), m_substream(substream) { FUNCTION_TRACE; substream->source = this; m_listsources.push_back(this); ++referenceCount; if (eventTriggerId == 0) { eventTriggerId = envir().taskScheduler().createEventTrigger(deliverFrame0); } m_BufferOffset = 0; m_NalIndex = 0; INFO("StreamSource constructor, this=0x%p, ref count =%d, StreamIndex = %d\r\n", this, referenceCount, substream->iStreamNo); } So I'm saving a pointer to the source in a parameter I pass in. The trouble is, I think, when a second client connects to the same stream, another instance of the class is created, and this pointer gets overwritten with the latest instance. Then, when I need to trigger the event when I have a NAL unit to send, I call this function:- void signalNewFrameData(StreamSource* source) { TaskScheduler* ourScheduler = &(source->envir().taskScheduler()); StreamSource* ourDevice = source; if (ourScheduler != NULL) { // sanity check TRACE("About to trigger Deliver event\r\n"); ourScheduler->triggerEvent(StreamSource::eventTriggerId, ourDevice); } } I only seem to call this function for the last source on this substream. I've inherited a lot of this code but do I need to trigger the event for all sources connected or am I totally misunderstanding this mechanism? Thanks - David
_______________________________________________ live-devel mailing list live-devel@lists.live555.com http://lists.live555.com/mailman/listinfo/live-devel