No subject
Sun Mar 15 18:43:03 CET 2009
Is this code 'thread safe'? I.e., can it be accessed by more than one
thread at the same time?
Short answer: No. As noted above, the code assumes a single thread of
execution, using an event loop - rather than multiple threads - for
concurrency. This generally makes the code much easier to debug, and
much easier to port across multiple operating systems, which may have
different thread APIs, or no thread support at all. (For even stronger
arguments along these same lines, see John Ousterhout's presentation.)
Longer answer: More than one thread can still use this code, if only
one thread runs the library code proper, and the other thread(s)
communicate with the library only by setting global 'flag' variables.
(For one possible use of this technique, see the answer to this
question.)
Another possible way to access the code from multiple threads is to
have each thread use its own "UsageEnvironment" and "TaskScheduler"
objects, and thus its own event loop. The objects created by each
thread (i.e., using its own "UsageEnvironment") must not interact
(except via global variables).
However, when using the "LIVE555 Streaming Media" code, you should be
familiar with event-driven programming, and understand that an
event-driven application can perform at least as well as one that uses
threads (unless you're actually running on a multiprocessor, in which
case it's usually simpler to have your application consist of multiple
processes (not just threads) - one running on each processor). Note,
in particular, that you do not need multiple threads in order to
transmit (or receive) multiple streams concurrently.
I tried to play a "rtsp://" URL (using VLC, MPlayer or openRTSP), or a
"sip:" URL (using playSIP), but I got an error message "RTP payload
format unknown or not supported". Why?
The problem here is that the "liveMedia" library does not support the
"RTP payload format" that is used to stream data with this particular
codec.
An "RTP payload format" for a codec is a set of rules that define how
the codec's media frames are packed within RTP packets. This is
usually defined by an IETF RFC, or - for newer payload formats - an
IETF Internet-Draft. However, a few RTP payload formats (usually those
whose MIME subtype begins with "X-") are proprietary, are not defined
in publically-available documents.
The "liveMedia" library supports many, but not all, RTP payload
formats. If you encounter a RTP payload format that is not supported,
but which is defined by a publically-available document, then we may
be able to add support for it, if there is sufficient interest.
Best Regards,
--=20
Rob Krakora
Senior Software Engineer
MessageNet Systems
101 East Carmel Dr. Suite 105
Carmel, IN 46032
(317)566-1677 Ext. 206
(317)663-0808 Fax
More information about the vlc-devel
mailing list