[Live-devel] Receiving in multiple threads
Rawling, Stuart
SRawling at pelco.com
Sun Mar 8 22:06:47 PDT 2009
I just wanted to update with my findings. As I suspected, the issue at hand
was that occasionally 2 different RTPClients in the same process would be
assigned the same client_port (either from the server or the algorithm in
MediaSession).
Basically, my finding is that if the 2 RTSPClient¹s (in separate threads and
usage environments) initiated at about the same time, they would both be
assigned the same port in their bind call. I notice that in GroupsockHelper
the library does set SO_REUSEADDR and SO_REUSEPORT so multiple binds binds
on the same port will work. Although on the same port in the same process,
in my experience only 1 receiver will be able to process the incoming UDP
packets. I have not tried this in multiple processes yet as you suggested,
I will try and do that and report back my findings.
I will be changing the plugin model to share a single UsageEnvironment and
TaskScheduler across many plugins to work around these issues. This
definitely appears to be the better way forward, and the way the library was
designed to be used.
Stuart
On 3/7/09 6:09 PM, "Ross Finlayson" <finlayson at live555.com> wrote:
>>> 1. My understanding is that so long as each instance of the library
>>> uses its own usageenvironment and event loop, it is ok to have multiple
>>> instances in multiple threads (although I agree this is really not advised).
>
> Yes, this should work, in principle. However, it has not been extensively
> tested, and I can't guarantee that there's not still some inadvertently
> shared state somewhere. (If anyone finds some, though, please let us know,
> and I'll try to remove it.)
>
> Have you tried putting your RTSP server in a separate *process* from your
> input plugins. (Since your plugins are communicating with the server via
> pipes, this should be straightforward, I think...)
>
>>> 3. Would it make sense to add an optional base port for the client to
>>> use, similar to RTSPServer?
>
> No, because there's no standard port number for RTSP *clients*.
- ------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this transmission is legally privileged and confidential, intended only for the use of the individual(s) or entities named above. This email and any files transmitted with it are the property of Pelco. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any review, disclosure, copying, distribution, retention, or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. If you receive this communication in error, please notify us immediately by telephone call to +1-559-292-1981 or forward the e-mail to administrator at pelco.com and then permanently delete the e-mail and destroy all soft and hard copies of the message and any attachments. Thank you for your cooperation.
- ------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20090308/05d97b60/attachment.html>
More information about the live-devel
mailing list