diff options
author | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-22 19:20:53 +0000 |
---|---|---|
committer | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-22 19:20:53 +0000 |
commit | c6fe6d8afeb05b15b07e8abbebd278704d9ca533 (patch) | |
tree | 37bbe75afc36aabffc2ecec9fbfcdb6bd546cd46 /channels/h323/ast_h323.cxx | |
parent | 0f47b052d063fe3677ded347842f9d7aec34567a (diff) |
Make chan_h323 respect packetization settings
Previously, packetization settings were ignored and now they are not. A new
config option 'autoframing' has been added to mirror the way chan_sip handles
it. Turning on the autoframing option (available both as a global option or per
peer) overrides the local settings with the remote packetization settings.
Testing was performed with varying packetization levels with the following
codecs: ulaw, alaw, gsm, and g729.
(closes issue #12415)
Reported by: pj
Patches:
2009012200_h323packetization.diff.txt uploaded by mvanbaak (license 7),
modified by me
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@189991 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/h323/ast_h323.cxx')
-rw-r--r-- | channels/h323/ast_h323.cxx | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/channels/h323/ast_h323.cxx b/channels/h323/ast_h323.cxx index 7309f1549..6c8b39d55 100644 --- a/channels/h323/ast_h323.cxx +++ b/channels/h323/ast_h323.cxx @@ -1878,7 +1878,6 @@ void MyH323Connection::SetCapabilities(int cap, int dtmf_mode, void *_prefs, int struct ast_codec_pref *prefs = (struct ast_codec_pref *)_prefs; struct ast_format_list format; int frames_per_packet; - int max_frames_per_packet; localCapabilities.RemoveAll(); @@ -1904,9 +1903,9 @@ void MyH323Connection::SetCapabilities(int cap, int dtmf_mode, void *_prefs, int if (!(cap & codec) || (alreadysent & codec) || !(codec & AST_FORMAT_AUDIO_MASK)) continue; alreadysent |= codec; + /* format.cur_ms will be set to default if packetization is not explicitly set */ format = ast_codec_pref_getsize(prefs, codec); frames_per_packet = (format.inc_ms ? format.cur_ms / format.inc_ms : format.cur_ms); - max_frames_per_packet = (format.inc_ms ? format.max_ms / format.inc_ms : 0); switch(codec) { #if 0 case AST_FORMAT_SPEEX: @@ -1926,37 +1925,30 @@ void MyH323Connection::SetCapabilities(int cap, int dtmf_mode, void *_prefs, int AST_G729Capability *g729Cap; lastcap = localCapabilities.SetCapability(0, 0, g729aCap = new AST_G729ACapability(frames_per_packet)); lastcap = localCapabilities.SetCapability(0, 0, g729Cap = new AST_G729Capability(frames_per_packet)); - if (max_frames_per_packet) { - g729aCap->SetTxFramesInPacket(max_frames_per_packet); - g729Cap->SetTxFramesInPacket(max_frames_per_packet); - } + g729aCap->SetTxFramesInPacket(format.cur_ms); + g729Cap->SetTxFramesInPacket(format.cur_ms); break; case AST_FORMAT_G723_1: AST_G7231Capability *g7231Cap; lastcap = localCapabilities.SetCapability(0, 0, g7231Cap = new AST_G7231Capability(frames_per_packet, TRUE)); - if (max_frames_per_packet) - g7231Cap->SetTxFramesInPacket(max_frames_per_packet); + g7231Cap->SetTxFramesInPacket(format.cur_ms); lastcap = localCapabilities.SetCapability(0, 0, g7231Cap = new AST_G7231Capability(frames_per_packet, FALSE)); - if (max_frames_per_packet) - g7231Cap->SetTxFramesInPacket(max_frames_per_packet); + g7231Cap->SetTxFramesInPacket(format.cur_ms); break; case AST_FORMAT_GSM: AST_GSM0610Capability *gsmCap; lastcap = localCapabilities.SetCapability(0, 0, gsmCap = new AST_GSM0610Capability(frames_per_packet)); - if (max_frames_per_packet) - gsmCap->SetTxFramesInPacket(max_frames_per_packet); + gsmCap->SetTxFramesInPacket(format.cur_ms); break; case AST_FORMAT_ULAW: AST_G711Capability *g711uCap; lastcap = localCapabilities.SetCapability(0, 0, g711uCap = new AST_G711Capability(format.cur_ms, H323_G711Capability::muLaw)); - if (format.max_ms) - g711uCap->SetTxFramesInPacket(format.max_ms); + g711uCap->SetTxFramesInPacket(format.cur_ms); break; case AST_FORMAT_ALAW: AST_G711Capability *g711aCap; lastcap = localCapabilities.SetCapability(0, 0, g711aCap = new AST_G711Capability(format.cur_ms, H323_G711Capability::ALaw)); - if (format.max_ms) - g711aCap->SetTxFramesInPacket(format.max_ms); + g711aCap->SetTxFramesInPacket(format.cur_ms); break; default: alreadysent &= ~codec; |