[Live-devel] Problem handling multiple MPEG streams.

curt curt at showandtell.com
Fri Aug 12 18:27:19 PDT 2005


> >
>>>>>  Is there a way to handle multiple RTP streams safely?
>>>>
>>>>Note that you *don't* need to use multiple threads to receive multiple RTP 
>>>>streams.  Instead, you can just use a single thread (and UsageEnvironment 
>>>>and TaskScheduler and event loop).
>>>
>>>That sounds perfect!  Is there a sample that illustrates how one would do 
>>>this? I cannot figure out how to use more than one RTP source with MediaSink. 
>>>MediaSink::startPlaying takes a single MediaSource.   Is there another way to 
>>>startPlay before running the eventloop?
>>
>> No, but to handle several incoming sources, you create several different 
>> "MediaSink" objects - one for each source.  Then, call "startPlaying()" on 
>> each one, then call "doEventLoop()" to enter the event loop.
>>
>
> I tried the above with 2 MediaSinks (2 seperate MPEG1or2VideoRTPSources).  I 
> am finding that the MediaSink object who's startPlaying() is last called is 
> the only one that gets processed by the event loop.  More accurately, its the 
> only one who's MediaSink::continuePlaying gets called from within EventLoop 
> processing.  Does anybody have any suggestions?
>
> Also, concerning calling startPlaying() on each MediaSink object, does live 
> support adding MediaSink objects (through startPlaying()) after the 
> "doEventLoop()" has been started?

I found the source of my problem.  I was creating the first MediaSink object on 
my doEventLoop processing thread and the other[s] (and associated sockets) on 
the application thread.  This was causing socket handle overlap and different 
socket connections were being mapped to the same handler in BasicTaskScheduler, 
hence causing the initial MediaSink object sockets to be ignored.  Fixed by 
making sure all MediaSink objects are created on the same thread that does 
doEventLoop processing.  So far so good.




More information about the live-devel mailing list