traud / asterisk-amr

Asterisk 13 transcoding module: AMR-WB
The Unlicense
32 stars 19 forks source link

mode-set might be not ascending #21

Closed traud closed 2 years ago

traud commented 2 years ago

On the SDP layer, the audio format parameters a=fmtp for AMR (and AMR-WB) may include a set of modes allowed in the call. The current code of res_format_attr_amr parses the supported set in amr_parse_sdp_fmtp(.). And initializes the transcoding module with the last mode presented by the remote party. However, the last mode may not be the highest. For example:

  1. mode-set=0,2,5,7
  2. mode-set=7,5,2,0

are both expected to initialize the mode_current to 7. Currently, the first case gets mode 7; the second case gets mode 0.

However, this affects only internal calls which do not pass amr_getjoint(.). However, no existing AMR implementation is known to send the modes not ascending. All known implementations send either (a) no mode-set at all, or (b) a single mode in the mode-set, or (c) an ascending mode-set, like case 1.

Although this should not affect anyone, the issue was found in an internal code review.