Changes between Initial Version and Version 1 of media-flow


Ignore:
Timestamp:
Dec 5, 2006 10:44:14 AM (14 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • media-flow

    v1 v1  
     1= Understanding Media Flow = 
     2 
     3The diagram below shows the media interconnection of multiple parts in a typical call: 
     4 
     5[[Image(http://www.pjsip.org/images/media-flow.jpg)]] 
     6 
     7 
     8== Media Timing == 
     9 
     10The whole media flow is driven by timing of the sound device, especially the playback callback: 
     11 * when the sound device needs another frame to be played to the speaker, the sound device abstraction will call '''{{{play_cb()}}}''' callback that was registered to the sound device when it was created.  
     12 * the sound device port translates this {{{play_cb()}}} callback into {{{pjmedia_port_get_frame()}}} call to its downstream port, which in this case is a [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__CONF.htm Conference Bridge]. 
     13 * a {{{pjmedia_port_get_frame()}}} call to the conference bridge will trigger it to call another {{{pjmedia_port_get_frame()}}} for all ports in the conference bridge, mix the signal together where necessary, and deliver the mixed signal by calling {{{pjmedia_port_put_frame()}}} again for all ports in the bridge. After the bridge finishes processing all of these, it will then return the mixed signal for slot zero back to the original {{{pjmedia_port_get_frame()}}} call, which then will be processed by the sound device. 
     14 * a {{{pjmedia_port_get_frame()}}} call by conference bridge to a [http://www.pjsip.org/pjmedia/docs/html/group__PJMED__STRM.htm media stream port] will cause it to pick one frame from the [http://www.pjsip.org/pjmedia/docs/html/group__PJMED__JBUF.htm jitter buffer], decode the frame using the configured [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__CODEC.htm codec] (or apply Packet Lost Concealment/PLC if frame is lost), and return the PCM frame to the caller. Note that the jitter buffer is filled-in by other thread (the thread that polls the network sockets), and will be described in later section below. 
     15 * a {{{pjmedia_port_put_frame()}}} call by conference bridge to a [http://www.pjsip.org/pjmedia/docs/html/group__PJMED__STRM.htm media stream port] will cause it to encode the PCM frame with a [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__CODEC.htm codec] that was configured to the stream, pack it into RTP packet with its RTP session, update RTCP session, schedule RTCP transmission, and deliver the RTP/RTCP packets to the underlying [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__TRANSPORT__H.htm media transport] that was previously attached to the stream. The media transport then sends the RTP/RTCP packet to the network.