[Live-devel] Adding multiple sources

Stas Desyatnlkov stas at mer.co.il
Wed Apr 5 01:18:33 PDT 2006


The solution you proposed will work. However, I feel that what I did is
more robust and consumes less CPU as there is no polling involved.
I attach my code so anyone interested can use it.

What I did is a message source that needs to be instantiated like this:

	//Msg source
	in_addr msgAddr;
	msgAddr.s_addr = our_inet_addr("127.0.0.1");
	const Port msgPort(9999);
	Groupsock* msgSock = new Groupsock(*m_pEnv, msgAddr, msgPort,
1);
	MsgSource* pMsgSrc = new MsgSource(*m_pEnv, msgSock);
	char msgBuf[128];
	pMsgSrc->RegisterSource(MsgFunc, this, msgBuf, sizeof(msgBuf));

	void MsgFunc(void* user, void* data, int size, sockaddr_in&
fromAdr)
	{
		RTPReceiver* pCls = (RTPReceiver*)user;
		pCls->m_watch = True;
	}

Now any other thread can simply use UDP socket to send a message. The
message will unlock the select call of the doEventLoop and MsgFunc
callback is invoked.

Hope this helps,
Stas.

-----Original Message-----
From: live-devel-bounces at ns.live555.com
[mailto:live-devel-bounces at ns.live555.com] On Behalf Of Ross Finlayson
Sent: Tuesday, April 04, 2006 10:57 AM
To: LIVE555 Streaming Media - development & use
Subject: Re: [Live-devel] Adding multiple sources


>The problem with this solution is - when the doEventLoop is blocked 
>on select it will not react to the watch variable.

Someone else encountered this same situation last week.  Here was my 
suggested solution:

http://lists.live555.com/pipermail/live-devel/2006-March/004192.html


	Ross Finlayson
	Live Networks, Inc. (LIVE555.COM)
	<http://www.live555.com/>

_______________________________________________
live-devel mailing list
live-devel at lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: MsgSource.cpp
Type: application/octet-stream
Size: 1451 bytes
Desc: MsgSource.cpp
Url : http://lists.live555.com/pipermail/live-devel/attachments/20060405/e6ef66b0/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MsgSource.h
Type: application/octet-stream
Size: 980 bytes
Desc: MsgSource.h
Url : http://lists.live555.com/pipermail/live-devel/attachments/20060405/e6ef66b0/attachment-0001.obj 


More information about the live-devel mailing list