[Asterisk-code-review] chan pjsip: Multistream: Modify use of ast sip session media (asterisk[master])

Mark Michelson asteriskteam at digium.com
Thu Jun 15 14:33:03 CDT 2017


Mark Michelson has uploaded a new patch set (#2). ( https://gerrit.asterisk.org/5851 )

Change subject: chan_pjsip: Multistream: Modify use of ast_sip_session_media
......................................................................

chan_pjsip: Multistream: Modify use of ast_sip_session_media

This commit reworks the use of ast_sip_session media structures in order
to facilitate multistream behavior in chan_pjsip.

Prior to this commit the ast_sip_session structure contained an
ao2_container of ast_sip_session_media structures. This container was a
hash table keyed on the media type. At session creation, a session media
structure was pre-allocated for each supported media type and added to
the container. This effectively limited the allocation of session media
to being one per media type.

With this commit, this limitation is lifted. The following has been
changed:

* Rather than using an ao2_container, session medias are stored in a
  vector on the session. This allows for the index of the session media
  to be important, rather than the media type. The index of the session
  media vector corresponds to the index of our local SDP as well as the
  index of the stream topology on which the local SDP is based.

* Session media structures are not pre-allocated at session creation.
  Rather, they are created as needed due to the circumstances
  surrounding the session. Typically, session media structures are
  allocated based on a stream topology that will be represented by our
  local SDP. So typically the session media is allocated at the time of
  SDP creation. The big exception to this is during outbound session
  creation. We create the session media at that time due to assumptions
  made in chan_pjsip about session media already being allocated.

In addition to the primary changes, there are some changes that rippled
out of this change

* Because the index is important to have in the SDP handlers, some SDP
  handler functions have had their parameters changed. Rather than
  explicitly passing in SDP streams and a session media, we pass in a
  session, an SDP (or two), and an index. The index can be used to find
  the appropriate SDP stream, session media, and Asterisk stream this
  way, since the all correspond to the same index.

* Because a session media corresponds to an index in the SDP, this can
  result in a session media changing types. The most common cause of
  this would be for a session media changing from audio to T.38. In such
  a case, we need to be able to change the session media's type as
  necessary. Because of the type being variable, it means that we can no
  longer store the RTP instance and UDPTL as a union. They need to be
  distinct structures. This way, a session media could switch back and
  forth between types without causing memory problems.

NOTE: This change breaks some tests in the testsuite. Specifically, it
breaks the tests that make sure that Asterisk only accepts one stream of
each media type. The next change I will be working on will add
configuration values that govern the number of streams allowed on a
session. With that change in place, the default values will result in
those tests passing again. Therefore, it's not worth it for me to go to
special effort with this change to ensure those tests are passing.

Change-Id: I144b04f43633387b8e42a43ef3b25d7c5682b451
---
M channels/chan_pjsip.c
M include/asterisk/res_pjsip_session.h
M res/res_pjsip_sdp_rtp.c
M res/res_pjsip_session.c
M res/res_pjsip_t38.c
5 files changed, 373 insertions(+), 281 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/51/5851/2
-- 
To view, visit https://gerrit.asterisk.org/5851
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I144b04f43633387b8e42a43ef3b25d7c5682b451
Gerrit-Change-Number: 5851
Gerrit-PatchSet: 2
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170615/6bdc10e4/attachment-0001.html>


More information about the asterisk-code-review mailing list