|
|
Transmitting and Receiving Custom RTP Payloads
|
|
Problem
How to transmit and receive custom RTP payloads using JMF.
There are a variety of reasons why one may want this: perhaps
there's a more efficient streaming format other than the standard
formats supported; or perhaps you need to inject some additional data
along the bit streams.
Solution
For the purpose of this example, we define a custom PCM payload
that's used for sending uncompressed PCM (linear) data. This
payload of course will demand higher bandwidth requirements. But
since it's uncompressed, there will not be loss of audio quality.
Two classes PcmPacketizer and PcmDepacketizer are written.
PcmPacketizer takes uncompressed PCM audio input and packetizes the data
for RTP transmission. PcmDepacketizer does the reverse by taking
the packetized data and converts it back to PCM data.
AVTransmit2
and
AVReceive2
are then modified as AVCustomTrans
and AVCustomRecv. AVCustomTrans registers PcmPacketizer with
PlugInManager and the custom payload format with RTPManager.
It then goes through similar logic as AVTransmit2 to
configure a Processor; but sets the custom format as the
data output for RTP transmission.
On the receive side, AVCustomRecv similarly registers
the custom format and PcmDepacketizer for use with RTPManager
and the Player for receiving and playing back the stream.
|
|
| Requirements |
|
| Platform: |
JDK 1.1.6 or later |
| JMF API: |
2.0 or later |
| Implementation: |
AJ, WPP, SPP * |
| Hardware: [optional] |
Capture card required for live capture. |
* AJ = All Java, WPP = Windows Performance Pack, SPP =
Solaris Performance Pack |
|
|
| Related Classes |
|
|
|
|
| How to run this sample |
|
-
Download and compile the source file.
-
Run AVCustomTrans with the required 3 command line parameters
For example,
java AVCustomTrans file:/avmedia.mov 224.1.2.3 42050
-
Then run AVCustomRecv to receive the streams transmitted from AVCustomTrans.
For example,
java AVCustomRecv 224.1.2.3/42050 224.1.2.3/42052
assuming that the media transmitted from AVCustomTrans contains
2 tracks -- port 42050 is used to receive the first track; 42052 the
second track.
|
|
| Source Code |
|
|
|
|
| See Also |
|
-
JMF 2.0 Programmer's Guide
|
|