📄 rtparchitecture.html
字号:
<li><a name="103857"> </a><font face="Palatino, Times New Roman, Times, serif">The transfer of data from the <code>DataSource</code> used to create the send stream has started or stopped. </font>
<li><a name="103858"> </a><font face="Palatino, Times New Roman, Times, serif">The send stream's format or payload changes.</font>
</ul>
<p>
<a name="103859"> </a><font face="Palatino, Times New Roman, Times, serif">There are five types of events associated with a <code>SendStream</code>:</font>
</p>
<ul>
<li><a name="103860"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>NewSendStreamEvent</strong>: Indicates that a new send stream has been created by the local participant.</font>
<li><a name="103861"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>ActiveSendStreamEvent</strong>: Indicates that the transfer of data from the <code>DataSource</code> used to create the send stream has started.</font>
<li><a name="103862"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>InactiveSendStreamEvent</strong>: Indicates that the transfer of data from the DataSource used to create the send stream has stopped.</font>
<li><a name="103863"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>LocalPayloadChangeEvent</strong>: Indicates that the stream's format or payload has changed.</font>
<li><a name="106572"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>StreamClosedEvent</strong>: Indicates that the stream has been closed.</font>
</ul>
<h5>
<a name="103864"> </a><i><font color="#003366" face="Palatino, Times New Roman, Times, serif">Receive Stream Listener</font></i>
</h5>
<p>
<a name="103865"> </a><font face="Palatino, Times New Roman, Times, serif">You can implement <code>ReceiveStreamListener</code> to receive notification whenever: </font>
</p>
<ul>
<li><a name="103866"> </a><font face="Palatino, Times New Roman, Times, serif">New receive streams are created.</font>
<li><a name="103867"> </a><font face="Palatino, Times New Roman, Times, serif">The transfer of data starts or stops.</font>
<li><a name="103868"> </a><font face="Palatino, Times New Roman, Times, serif">The data transfer times out.</font>
<li><a name="103869"> </a><font face="Palatino, Times New Roman, Times, serif">A previously orphaned <code>ReceiveStream</code> has been associated with a <code>Participant</code>.</font>
<li><a name="103870"> </a><font face="Palatino, Times New Roman, Times, serif">An RTCP APP packet is received.</font>
<li><a name="103871"> </a><font face="Palatino, Times New Roman, Times, serif">The receive stream's format or payload changes.</font>
</ul>
<p>
<a name="105743"> </a><font face="Palatino, Times New Roman, Times, serif">You can also use this interface to get a handle on the stream and access the RTP <code>DataSource </code>so that you can create a <code>MediaHandler</code>. </font>
</p>
<p>
<a name="105744"> </a><font face="Palatino, Times New Roman, Times, serif">There are seven types of events associated with a <code>ReceiveStream</code>:</font>
</p>
<ul>
<li><a name="105745"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>NewReceiveStreamEvent</strong>: Indicates that the session manager has created a new receive stream for a newly-detected source.</font>
<li><a name="103875"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>ActiveReceiveStreamEvent</strong><code>:</code> Indicates that the transfer of data has started.</font>
<li><a name="104010"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>InactiveReceiveStreamEvent</strong>: Indicates that the transfer of data has stopped.</font>
<li><a name="103877"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>TimeoutEvent</strong>: Indicates that the data transfer has timed out.</font>
<li><a name="103878"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>RemotePayloadChangeEvent</strong>: Indicates that the format or payload of the receive stream has changed.</font>
<li><a name="103879"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>StreamMappedEvent</strong>: Indicates that a previously orphaned receive stream has been associated with a participant.</font>
<li><a name="103880"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>ApplicationEvent</strong>: Indicates that an RTCP APP packet has been received.</font>
</ul>
<h5>
<a name="103881"> </a><i><font color="#003366" face="Palatino, Times New Roman, Times, serif">Remote Listener</font></i>
</h5>
<p>
<a name="104032"> </a><font face="Palatino, Times New Roman, Times, serif">You can implement <code>RemoteListener</code> to receive notification of events or RTP control messages received from a remote participants. You might want to implement <code>RemoteListener </code>in an application used to monitor the session--it enables you to receive RTCP reports and monitor the quality of the session reception without having to receive data or information on each stream. </font>
</p>
<p>
<a name="103883"> </a><font face="Palatino, Times New Roman, Times, serif">There are three types of events associated with a remote participant:</font>
</p>
<ul>
<li><a name="103884"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>ReceiverReportEvent</strong>: Indicates that an RTP receiver report has been received.</font>
<li><a name="104098"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>SenderReportEvent</strong>: Indicates that an RTP sender report has been received.</font>
<li><a name="104099"> </a><font face="Palatino, Times New Roman, Times, serif"><strong>RemoteCollisionEvent</strong>: Indicates that two remote participants are using the same synchronization source ID (SSRC).</font>
</ul>
<h4>
<a name="103785"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">RTP Data</font>
</h4>
<p>
<a name="104842"> </a><font face="Palatino, Times New Roman, Times, serif">The streams within an RTP session are represented by <code>RTPStream</code> objects. There are two types of <code>RTPStreams</code>: <code>ReceiveStream</code> and <code>SendStream</code>. Each RTP stream has a buffer data source associated with it. For <code>ReceiveStreams</code>, this <code>DataSource</code> is always a <code>PushBufferDataSource</code>.</font>
</p>
<p>
<a name="106088"> </a><font face="Palatino, Times New Roman, Times, serif">The session manager automatically constructs new receive streams as it detects additional streams arriving from remote participants. You construct new send streams by calling <code>createSendStream</code> on the session manager.</font>
</p>
<h5>
<a name="105881"> </a><i><font color="#003366" face="Palatino, Times New Roman, Times, serif">Data Handlers</font></i>
</h5>
<p>
<a name="105890"> </a><font face="Palatino, Times New Roman, Times, serif">The JMF RTP APIs are designed to be transport-protocol independent. A custom RTP data handler can be created to enable JMF to work over a specific transport protocol. The data handler is a <code>DataSource</code> that can be used as the media source for a <code>Player</code>.</font>
</p>
<p>
<a name="105856"> </a><font face="Palatino, Times New Roman, Times, serif">The abstract class <code>RTPPushDataSource</code> defines the basic elements of a JMF RTP data handler. A data handler has both an input data stream (<code>PushSourceStream</code>) and an output data stream (<code>OuputDataStream</code>). A data handler can be used for either the data channel or the control channel of an RTP session. If it is used for the data channel, the data handler implements the <code>DataChannel</code> interface. </font>
</p>
<p>
<a name="106014"> </a><font face="Palatino, Times New Roman, Times, serif">An <code>RTPSocket</code> is an <code>RTPPushDataSource</code> has both a data and control channel. Each channel has an input and output stream to stream data to and from the underlying network. An <code>RTPSocket</code> can export <code>RTPControls</code> to add dynamic payload information to the session manager.</font>
</p>
<p>
<a name="105964"> </a><font face="Palatino, Times New Roman, Times, serif">Because a custom <code>RTPSocket</code> can be used to construct a <code>Player</code> through the <code>Manager</code>, JMF defines the name and location for custom <code>RTPSocket</code> implementations:</font>
</p>
<pre>
<a name="105980"> </a><code><protocol package-prefix>.media.protocol.rtpraw.DataSource
</code></pre>
<p>
<a name="105857"> </a><font face="Palatino, Times New Roman, Times, serif"><em>RTP Data Formats</em></font>
</p>
<p>
<a name="106099"> </a><font face="Palatino, Times New Roman, Times, serif">All RTP-specific data uses an RTP-specific format encoding as defined in the <code>AudioFormat</code> and <code>VideoFormat </code>classes. For example, gsm RTP encapsulated packets have the encoding set to <code>AudioFormat.GSM_RTP</code>, while jpeg-encoded video formats have the encoding set to<code> VideoFormat.JPEG_RTP</code>. </font>
</p>
<p>
<a name="106100"> </a><font face="Palatino, Times New Roman, Times, serif"><code>AudioFormat</code> defines four standard RTP-specific encoding strings:</font>
</p>
<pre>
<a name="106101"> </a>public static final String ULAW_RTP = "JAUDIO_G711_ULAW/rtp";
public static final String DVI_RTP = "dvi/rtp";
public static final String G723_RTP = "g723/rtp";
public static final String GSM_RTP = "gsm/rtp";
</pre>
<p>
<a name="106105"> </a><font face="Palatino, Times New Roman, Times, serif"><code>VideoFormat</code> defines three standard RTP-specific encoding strings:</font>
</p>
<pre>
<a name="106106"> </a>public static final String JPEG_RTP = "jpeg/rtp";
public static final String H261_RTP = "h261/rtp";
public static final String H263_RTP = "h263/rtp";
</pre>
<h4>
<a name="106123"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">RTP Controls</font>
</h4>
<p>
<a name="105860"> </a><font face="Palatino, Times New Roman, Times, serif">The RTP API defines one RTP-specific control, <code>RTPControl</code>. <code>RTPControl</code> is typically implemented by RTP-specific <code>DataSources</code>. It provides a mechanism to add a mapping between a dynamic payload and a <code>Format</code>. <code>RTPControl</code> also provides methods for accessing session statistics and getting the current payload <code>Format</code>. </font>
</p>
<p>
<a name="104881"> </a><font face="Palatino, Times New Roman, Times, serif"><code>SessionManager</code> also extends the <code>Controls</code> interface, enabling a session manager to export additional <code>Controls</code> through the <code>getControl</code> and <code>getControls</code> methods. For example, the session manager can export a <code>BufferControl</code> to enable you to specify the buffer length and threshold.</font>
</p>
<h3>
<a name="103690"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">Reception</font>
</h3>
<p>
<a name="106292"> </a><font face="Palatino, Times New Roman, Times, serif">The presentation of an incoming RTP stream is handled by a <code>Player</code>. To receive and present a single stream from an RTP session, you can use a <code>MediaLocator</code> that describes the session to construct a <code>Player</code>. A media locator for an RTP session is of the form:</font>
</p>
<pre>
<a name="106308"> </a>rtp://address:port[:ssrc]/content-type/[ttl]
</pre>
<p>
<a name="106332"> </a><font face="Palatino, Times New Roman, Times, serif">The <code>Player</code> is constructed and connected to the first stream in the session.</font>
</p>
<p>
<a name="106248"> </a><font face="Palatino, Times New Roman, Times, serif">If there are multiple streams in the session that you want to present, you need to use a session manager. You can receive notification from the session manager whenever a stream is added to the session and construct a <code>Player</code> for each new stream. Using a session manager also enables you to directly monitor and control the session. </font>
</p>
<h3>
<a name="103724"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">Transmission</font>
</h3>
<p>
<a name="106126"> </a><font face="Palatino, Times New Roman, Times, serif">A session manager can also be used to initialize and control a session so that you can stream data across the network. The data to be streamed is acquired from a <code>Processor</code>. </font>
</p>
<p>
<a name="106159"> </a><font face="Palatino, Times New Roman, Times, serif">For example, to create a send stream to transmit data from a live capture source, you would:</font>
</p>
<ol type="1">
<li value="1"><a name="104828"> </a><font face="Palatino, Times New Roman, Times, serif">Create, initialize, and start a <code>SessionManager</code> for the session.</font>
<li value="2"><a name="106165"> </a><font face="Palatino, Times New Roman, Times, serif">Construct a <code>Processor</code> using the appropriate capture <code>DataSource</code>.</font>
<li value="3"><a name="104921"> </a><font face="Palatino, Times New Roman, Times, serif">Set the output format of the <code>Processor</code> to an RTP-specific format. An appropriate RTP packetizer codec must be available for the data format you want to transmit. </font>
<li value="4"><a name="104924"> </a><font face="Palatino, Times New Roman, Times, serif">Retrieve the output <code>DataSource</code> from the <code>Processor</code>. </font>
<li value="5"><a name="104831"> </a><font face="Palatino, Times New Roman, Times, serif">Call <code>createSendStream</code> on the session manager and pass in the <code>DataSource</code>.</font>
</ol>
<p>
<a name="104832"> </a><font face="Palatino, Times New Roman, Times, serif">You control the transmission through the <code>SendStream</code> <code>start</code> and <code>stop</code> methods.</font>
</p>
<p>
<a name="106234"> </a><font face="Palatino, Times New Roman, Times, serif">When it is first started, the <code>SessionManager</code> behaves as a receiver (sends out RTCP receiver reports). As soon as a <code>SendStream</code> is created, it begins to send out RTCP sender reports and behaves as a sender host as long as one or more send streams exist. If all <code>SendStreams</code> are closed (not just stopped), the session manager reverts to being a passive receiver.</font>
</p>
<h3>
<a name="103723"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">Extensibility</font>
</h3>
<p>
<a name="103707"> </a><font face="Palatino, Times New Roman, Times, serif">Like the other parts of JMF, the RTP capabilities can be enhanced and extended. The RTP APIs support a basic set of RTP formats and payloads. Advanced developers and technology providers can implement JMF plug-ins to support dynamic payloads and additional RTP formats. </font>
</p>
<h4>
<a name="103731"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">Implementing Custom Packetizers and Depacketizers</font>
</h4>
<p>
<a name="103737"> </a><font face="Palatino, Times New Roman, Times, serif">To implement a custom packetizer or depacketizer, you implement the JMF <code>Codec</code> interface. (For general information about JMF plug-ins, see <a href="JMFExtending.html#101313">Implementing JMF Plug-Ins</a>.)</font>
</p>
</blockquote>
<br clear="all">
<hr>
<a href="JMFTOC.html">CONTENTS</a> |
<a href="RTPRealTime.html">PREV </a> |
<a href="RTPPresenting.html">NEXT</a> |
<a href="JMFIX.html">INDEX</a></td>
<br>
<hr>
<em>
<a href="copyright.html">Copyright</a> ©
1998-1999 Sun Microsystems, Inc. All Rights Reserved.
</em>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -