Changes between Version 6 and Version 7 of 0.9/Media_Interface_Change


Ignore:
Timestamp:
Jun 17, 2008 3:17:35 PM (16 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 0.9/Media_Interface_Change

    v6 v7  
    4444= New = 
    4545 
    46 ''New code in italics''. 
     46''New code in italics''. ~~Deleted code is in strike-through~~. 
    4747 
    4848== pjsua_call.c == 
    49 Currently this is how the media channel interacts with SIP call in PJSUA-LIB. 
     49This is the proposed interaction: 
    5050 
    5151 '''pjsua_call_make_call()''' : :: 
     
    105105  '''New:''' {{{encode_sdp()}}}:: 
    106106   1. This function is used to modify local SDP with transport info. It can be called for different purposes below. 
    107    1. '''generating initial offer''': this happens for outgoing calls, right after {{{media_create()}}} is called. The transport must initialize local SDP with default values (for ICE: include all candidates. For SRTP: include all crypto options). Normally it does not need to modify it's state. 
    108    1. '''generating initial answer''': this happens for incoming calls, also right after {{{media_create()}}} is called. The transport must inspect the remote SDP '''and'''' update the transport according to the info in remote SDP '''and''' update local SDP to be sent as answer. For example: disable the feature if remote SDP doesn't contain the required attributes. 
    109    1. '''generating subsequent offer''': this happens when local endpoint sends UPDATE or re-INVITE. In this case, the transport '''MUST NOT''' modify it's state, and rather just encode it's current state in the local SDP. 
    110    1. '''generating subsequent answer''': this happens when we receive UPDATE or re-INVITE. The processing is similar to ''generating initial answer'' above. 
    111107 
    112108 {{{media_start()}}}:: 
    113109  1. The syntax has changed: 
    114110     - the local SDP is now ''const''. This is because it's useless to modify the local SDP there since the SDP has already been negotiated. 
     111 
     112 
     113== Sample: ICE processing with the new media framework == 
     114 
     115=== Generating initial offer === 
     116 
     117This happens in {{{encode_sdp()}}}, when ICE is not running and {{{rem_sdp==NULL}}. The transport will include all ICE candidates in the offer. 
     118 
     119=== Generating initial answer === 
     120 
     121First, the transport detects whether the remote offer contains ICE in {{{media_create()}}}. If yes, it marks {{{use_ice=True}}}. 
     122 
     123Then in {{{encode_sdp()}}}, it checks if ICE is already running. Since this is an initial answer, ICE is not running yet. So it puts all candidates in the answer. In this function, the transport also checks for ICE-mismatch. 
     124 
     125=== Generating subsequent offer === 
     126 
     127This happens in {{{encode_sdp()}}}, when ICE is already running and {{{rem_sdp==NULL}}}. The transport fills in the SDP with selected candidate only, one for each component. 
     128 
     129=== Generating subsequent answer === 
     130 
     131This happens in {{{encode_sdp()}}}, when ICE is already running and {{{rem_sdp}}} is present. The transport detects for ICE '''restart''' condition or if the new offer no longer contains support for ICE. If ICE is restarted, then the internal ICE session will be destroyed and re-created. 
     132 
     133The populated SDP depends on whether ICE is restarted or not. If ICE doesn't restart, then the answer contains only the selected candidate from the valid pairs, just like ''Generating subsequent offer'' above. If ICE is restarted, then it will contains all candidates. 
     134 
     135=== media_start() processing === 
     136 
     137When we send offer, this is where we will see the remote answer for the first time. So we do the "heavy" negotiation here. 
     138 
     139For ICE: 
     140 - Detect if answer contains ICE support ==> disable ICE 
     141 - Handle answer that contains ice-mismatch attribute ==> disable ICE 
     142 - Handle answer with transport address that doesn't match any candidates ==> disable ICE 
     143 - Handle when we set our role as Controlled, but answer contains ice-list ==> change role to Controlling 
     144 - If remote SDP contains the same ice-ufrag and ice-pwd as previous SDP, that means there's no change in the offer/answer, no need to do anything. 
     145 
     146If things are okay, start ICE negotiation. 
    115147 
    116148