首頁 專題研究之動機與目標 開發工具與環境 VOIP之介紹 影音播放與影像傳輸的概念與應用 架構流程圖 未來改進與加強 心得 參考資料

架構流程圖:分為傳送端、接收端、 GUI 三大部分

5-1 Transmitting RTP Media Streams:

5-2 Receiving RTP Media Streams:

5-3 GUI:

•  Media processing model:

傳送端:由 Capture 送出 data 經由 Process 送到網路。

接收端:由網路接收資料經由 Process 將 data 播放出來。

詳細過程會在以下說明,分為 Transmit 和 Receive。

5-1 Transmitting RTP Media Streams:

以下將會個別介紹各個 BLOCK 的功能及其操作流程。

5-1-1 Processor:

•  Produce an RTP-encoded DataSource.

•  Configuring the Processor.

•  Retrieving the Processor Output.

•  Controlling the Packet Delay.

5-1-2 Configuring the Processor:

•  Set RTP-specific formats for each track and specify the content descriptor you want.

•  Getting TrackControl for each track and calling setFormat to specify an RTP-specific format.

•  Example : AudioFormat.GSM_RTP.

•  Output format : setOutputContentDescriptor (method).

5-1-3 Retrieving the Processor Output:

•  Calling getDataOutput.

•  DataSource can be either a PushBufferDataSource or a PullBufferDataSource.

•  Connecting to the SessionManager using the createSendStream (method).

•  Multiple SourceStreams is sent out as a separate RTPstream, either in the same session or a different session.

5-1-4 Controlling the Packet Delay:

•  If the codec allows modification the interval.

•  Using the setPcketSize (method) of the packetizer codec's PacketSizeControl.

5-1-5 MediaLocator:

•  Calling Manager.createDataSink to construct an RTP DataSink.

•  Only transmit the first stream in the DataSource.

•  Provides the address and port of the RTP session.

5-1-6 Session Manager:

•  Creating send streams for the content and control the transmission.

•  To transmit multiple RTP streams in a session or to need to monitor session statistics.

5-1-7 Transmitting RTP Data using a DataSink:

•  Simplest way to transmit RTP data is to construct an RTP DataSink using Manager.creatDataSink (method).

•  You call start and stop on the DataSink.

•  Again, only the first stream in the DataSource is transmitted.

上圖即為 Transmit 的整個設計架構, Processor 處理來自 camera 的 data 之後 ,輸入對方 IP 將 data 送

到網路上等待接收端接收,其中 Audio 的 port 為 Video 的 port 加上 2 。Return to top

5-2 Receiving RTP Media Streams:

5-2-1 Session Manager:

5-2-2 MediaLocator:

接收主要可分為 2 個方式,一個是經由上面的路徑,也就是經由 MediaLocator 到 Data Source 到

Player 然後播放出檔案,另一個是經由下面的路徑,也就是經由 Session Manager 到 Data Source 到

Player 之後播放出檔案,在以下將會分析這 2 個路徑的不同。

在分析之前,先介紹一下何謂 Session Manager 和 MediaLocator ,及其功能:

5-2-1 Session Manager:

  • keeps track of all of the participants in a session.

  • used to coordinate an RTP session.

  • maintain statistics on all of the RTP and RTCP packets sent and received in the session.

 

Session Manager 又包含了 2 個部份

  • Session Statistics:
  1. Statistics are tracked for the entire session on a per-stream basis.

  2. GlobalReceptionStats:

    Maintains global reception statistics for the session.

  3. GlobalTransmissionStats:

    Maintains cumulative transmission statistics for all local sender.

  4. ReceptionStats:

    Maintains source reception statistics for an individual participant.

  5. TransmissionStats:

    Maintains transmission statistics for an individual send stream.
  • Session Streams:
  1. eceiveStream:

    represents a stream that is being received from a remote participant.

  2. SendStream:

    represents a stream of data coming from the Processor on input. Return

5-2-2 MediaLocator:

  • An object that describes the media that a Player presents.

  • Can be constructed even if the corresponding protocol handler is not installed on the system.

以下將介紹 2 種接收的方法:

第一種:經由 Session Manager 到 Data Source 到 Player 之後播放出檔案。

  • Using this type you can deal with multiple RTP streams in the session.

  • Construct a Player for each new receiveStream by retrieving the DataSource from the stream and passing it to Manager.createPlayer.

  • When format or payload changes, the Player will not be able to handle the new format and JMF will throw an error if you attempt to present the new payload.

  • ReceiveStreamListener needs to watch for RemotePayloadChangeEvent.

  • When a RemotePayloadChangeEvent is detected, you need to:

    1. Close the existing Player.

    2. Remove all listener for the removed Player.

    3. Create a new Player with the same RTP DataSource.

    4. Get the visual and control Components for the new Player.

    5. Add the necessary listeners to the new Player.

第二種:經由 MediaLocator 到 Data Source 到 Player 然後播放出檔案。

  • Using this type you can only present the first RTP stream that is detected in the session.

  • Construct a Player by calling Manager.createPlayer.

  • When format or payload changes, Players automatically process payload changes. In most casts, this processing involves constructing a new Player to handle the new format.

以上 2 種方法不同之比較:

  1. 使用第一種方法能在一個 session 中同時處理多個 RTP streams ,使用第二種則只能一次處理一個 RTP streams。

  2. 當 payload 改變時,第一種傳輸方式的 Player 會無法應變,當你嘗試想要播放時就會出現錯誤。而第二種傳輸方式的 Player 當 payload 改變時它會自動的去建構一個新的 Player 使之能夠播放新的格式。

上圖即為 Receive 的整個設計架構,傳送端送出 data 後,接收端輸入自己的 IP 然後等待接收 data ,其中 Audio

的 port 為 Video 的 port 再加上 2 。Return Return to top

5-3 GUI:

Return to top