<p>Joshua Colp <strong>uploaded patch set #3</strong> to the change originally created by Mark Michelson.</p><p><a href="https://gerrit.asterisk.org/5851">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_pjsip: Multistream: Modify use of ast_sip_session_media<br><br>This commit reworks the use of ast_sip_session media structures in order<br>to facilitate multistream behavior in chan_pjsip.<br><br>Prior to this commit the ast_sip_session structure contained an<br>ao2_container of ast_sip_session_media structures. This container was a<br>hash table keyed on the media type. At session creation, a session media<br>structure was pre-allocated for each supported media type and added to<br>the container. This effectively limited the allocation of session media<br>to being one per media type.<br><br>With this commit, this limitation is lifted. The following has been<br>changed:<br><br>* Rather than using an ao2_container, session medias are stored in a<br>  vector on the session. This allows for the index of the session media<br>  to be important, rather than the media type. The index of the session<br>  media vector corresponds to the index of our local SDP as well as the<br>  index of the stream topology on which the local SDP is based.<br><br>* Session media structures are not pre-allocated at session creation.<br>  Rather, they are created as needed due to the circumstances<br>  surrounding the session. Typically, session media structures are<br>  allocated based on a stream topology that will be represented by our<br>  local SDP. So typically the session media is allocated at the time of<br>  SDP creation. The big exception to this is during outbound session<br>  creation. We create the session media at that time due to assumptions<br>  made in chan_pjsip about session media already being allocated.<br><br>In addition to the primary changes, there are some changes that rippled<br>out of this change<br><br>* Because the index is important to have in the SDP handlers, some SDP<br>  handler functions have had their parameters changed. Rather than<br>  explicitly passing in SDP streams and a session media, we pass in a<br>  session, an SDP (or two), and an index. The index can be used to find<br>  the appropriate SDP stream, session media, and Asterisk stream this<br>  way, since the all correspond to the same index.<br><br>* Because a session media corresponds to an index in the SDP, this can<br>  result in a session media changing types. The most common cause of<br>  this would be for a session media changing from audio to T.38. In such<br>  a case, we need to be able to change the session media's type as<br>  necessary. Because of the type being variable, it means that we can no<br>  longer store the RTP instance and UDPTL as a union. They need to be<br>  distinct structures. This way, a session media could switch back and<br>  forth between types without causing memory problems.<br><br>NOTE: This change breaks some tests in the testsuite. Specifically, it<br>breaks the tests that make sure that Asterisk only accepts one stream of<br>each media type. The next change I will be working on will add<br>configuration values that govern the number of streams allowed on a<br>session. With that change in place, the default values will result in<br>those tests passing again. Therefore, it's not worth it for me to go to<br>special effort with this change to ensure those tests are passing.<br><br>Change-Id: I144b04f43633387b8e42a43ef3b25d7c5682b451<br>---<br>M channels/chan_pjsip.c<br>M include/asterisk/res_pjsip_session.h<br>M res/res_pjsip_sdp_rtp.c<br>M res/res_pjsip_session.c<br>M res/res_pjsip_t38.c<br>5 files changed, 372 insertions(+), 281 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/51/5851/3</pre><p>To view, visit <a href="https://gerrit.asterisk.org/5851">change 5851</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/5851"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>
<div style="display:none"> Gerrit-Change-Id: I144b04f43633387b8e42a43ef3b25d7c5682b451 </div>
<div style="display:none"> Gerrit-Change-Number: 5851 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Mark Michelson <mmichelson@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Mark Michelson <mmichelson@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>