Commit Graph

30 Commits

Author SHA1 Message Date
Neels Hofmeyr ee8f99308c sdp
Change-Id: I7f024d8496fd2541866bb34fbb1a574e348964a3
2024-02-25 03:49:31 +01:00
Neels Hofmeyr fd600eb6c2 sdp
Change-Id: I2ffd0ff70c859423c857e84dfaeddec1a0a33a27
2024-02-25 03:49:31 +01:00
Neels Hofmeyr f5a7003d86 wip
Change-Id: I974a02ecf8f280177c0ad616a05bb2aabf0d54ff
2024-02-25 03:49:31 +01:00
Neels Hofmeyr f2fca2a2b1 ws
Change-Id: Ib872882dd06f4240990abacbe22f32aadc7018ac
2024-02-25 03:49:31 +01:00
Neels Hofmeyr 521f0664a2 all AMR rates in codec_mapping
Change-Id: I1b3fde18a903a8072fecc49ee8ba60307bb2a94e
2024-02-25 03:47:56 +01:00
Neels Hofmeyr 934c263e0e dbg log
Change-Id: Ia3332166bd2d599c8c12fe9c699c93f40eb1391c
2024-02-25 03:43:12 +01:00
Neels Hofmeyr cd7bcc3df2 tmp dbg log
Change-Id: I1341abf450c2b183bc8b0cf08ce13325512b18c7
2024-02-25 03:43:12 +01:00
Neels Hofmeyr 1802478428 tmp dbg
Change-Id: If8b30d6efc1c70ed0e5b0de5b27309f6fc3a2f1b
2024-02-25 03:43:12 +01:00
Neels Hofmeyr 02c466e224 codec_mapping: list FR-in-HR-compat last
Change-Id: I04a3baaced36bc99310e1a811cceda6c88030533
2024-02-25 03:43:12 +01:00
Neels Hofmeyr f091db0f20 bearer_cap_set_radio() traverse all matches
It's a minor technicality, but it seems the newly added API to
iterate the codec_mapping can slightly improve this implementation:

For some reason, the Bearer Capabilities should reflect whether any HR
codec is possible with its listed Speech Versions. So far we looked only
whether the first match for a given Speech Version in the global const
codec_mapping is a HR codec. Instead, look through *all* entries for a
Speech Version, and see if any one of them indicates HR.

For example, an AMR-FR codec with a well adjusted mode-set can work with
a half rate channel.

Change-Id: Ic964af4bec21598836748279f3fee480e470738c
2024-02-25 03:43:12 +01:00
Neels Hofmeyr 333f586578 full fmtp FU
Change-Id: I6156eaab2eb88f81848e61add5b62f435ac4739a
2024-02-25 03:43:12 +01:00
Neels Hofmeyr 314cc11a45 sdp_audio_codecs(): add 'once', 'pick_unused_pt_nr' args
So far the API is pivoting on the payload type numbers as the "primary
key" for codec lists. However, working with variants of codecs, the
payload type numbers are just incidental, and the API isn't helpful.

- change the behavior to regard the subtype name and fmtp as the
  defining identity of a codec: use sdp_audio_codec_cmp() to match.
- add argument 'once': flag to make sure a given subtype+fmtp exists
  only once, regardless of payload type nr.
- add argument 'pick_unused_pt_nr': flag to make sure a new entry
  doesn't duplicate payload type numbers.

This is preparation to properly match AMR variants, in order to fix the
expected error currently visible in msc_vlr_test_call.c:875.

Change-Id: I87db779dbab39dfdef2724488ccdb6959e6731ed
2024-02-25 03:43:12 +01:00
Neels Hofmeyr d5c45dc580 codecs: match all AMR rates and modes
In msc_a_up_call_assignment_complete(), iterate all the new AMR modes
and rates recently added to codec_mapping, and enlist all possible
matches.

Change-Id: I6163a51765efff998e05c9ee4e82a0a3759f2043
2024-02-25 03:43:12 +01:00
Neels Hofmeyr 64475fc6d8 codec_mapping: add amr flags
These flags are redundant, the aim is to speed up comparisons of AMR
fmtp when traversing a long list of codec variants. It can skip a lot of
repetitive strcmp and fmtp string parsing when used by a loop.

Change-Id: Ic2c9b4983b5374621e02389900e3622faa29cad9
2024-02-25 03:43:12 +01:00
Neels Hofmeyr 3083b970b3 codec_mapping: add all AMR variants
Change-Id: I09233c8c17fce591195b7762740f4d82a9961db6
2024-02-25 03:43:12 +01:00
Neels Hofmeyr cb0758d4ba sdp_audio_codecs_from_speech_codec_list: add all matches
Change-Id: Idd24d5e57f75e413c7027d34e1e2eb00b7c8f113
2024-02-25 03:43:12 +01:00
Neels Hofmeyr c2e4bfc585 codec_mapping_matches_gsm0808_speech_codec
Change-Id: I852c1647a1b14017bd4f0ae79d22d84de28187f8
2024-02-25 03:43:12 +01:00
Neels Hofmeyr d1039bb8a5 codec_mapping_matches_speech_ver
Change-Id: Iccd1f137674ef23dfa37a7e21086e046514ce39b
2024-02-25 03:43:12 +01:00
Neels Hofmeyr 21f1bfb4a8 add codec_mapping_next() and codec_mapping_foreach()
So far, querying the codec mapping returns one match.
For example:

 const struct codec_mapping *m;
 m = codec_mapping_by_speech_ver(GSM48_BCAP_SV_FR);
 if (!m)
         return -ENOENT;

But when supporting various AMR rates, we need to find multiple matches
in some code paths.

Also to support AMR OA vs BE modes, we need to combine multiple criteria
in some places.

With this patch, and as soon as an upcoming patch implements
codec_mapping_matches_speech_ver(), above code example becomes:

 const struct codec_mapping *m;
 codec_mapping_foreach (m) {
         if (codec_mapping_matches_speech_ver(m, GSM48_BCAP_SV_FR))
	         break;
 }
 if (!m)
         return -ENOENT;

This pattern supports collecting multiple matches in a list:

 const struct codec_mapping *m;
 codec_mapping_foreach (m) {
         if (codec_mapping_matches_speech_ver(m, GSM48_BCAP_SV_FR))
	         sdp_audio_codecs_add_copy(my_list, m);
 }

And this pattern also supports combining criteria:

 const struct codec_mapping *m;
 codec_mapping_foreach (m) {
	 // only allow AMR in OA mode
 	 if (!osmo_sdp_fmtp_amr_is_octet_aligned(m->sdp.fmtp))
	         continue;
         if (codec_mapping_matches_speech_ver(m, GSM48_BCAP_SV_AMR_F)
	     || codec_mapping_matches_speech_ver(m, GSM48_BCAP_SV_AMR_H))
	         sdp_audio_codecs_add_copy(my_list, m);
 }

Change-Id: Iaaa59d4bf5a6126a1bfe4ae282b82f6cb3ec6f99
2024-02-25 03:43:12 +01:00
Neels Hofmeyr e3059a74f7 fix sdp_audio_codec_to_speech_codec_list() for multiple AMR
Instead of returning multiple occurences of AMR as duplicated
gsm0808_speech_codec_type entries, combine their cfg bits to form a
single entry listing all AMR rate combinations that are allowed.

Prepare for AMR mode-set negotiation: soon we'll have multiple AMR
variants in codec_mapping.c, and then these must produce correct
gsm0808_speech_codec_list.

Change-Id: Ibeffb6c1325abebb904a14f00e6a0818870b119e
2024-02-25 03:43:12 +01:00
Neels Hofmeyr 4a9ea4f311 use new libosmo-mgcp-client sdp/fmtp.h where possible
Change-Id: I261679118e5fd669fa0f74e3d2220a82ba7d8835
2024-02-25 03:42:46 +01:00
Neels Hofmeyr 5a56df1db0 drop bogus support for AMR OFR and OHR variants
Looking at 3GPP TS 26.103 table 4.1, none of the AMR-Oxx variants are
supported by GERAN-GMSK nor UTRAN, so it makes no sense to include
these. There are no users of this.

Change-Id: I0cbc770fff55209676d9b6aae50011d6d5f897e2
2024-02-09 05:17:39 +01:00
Neels Hofmeyr c8bf895a04 cosmetic: rename to sdp_audio_codecs_foreach()
Better match the pattern of sdp_audio_codecs_* instead of having
foreach_ in the front. Prepare for prepending osmo_ some day, because I
plan to move the SDP API to a separate library.

Change-Id: Ia96190e0bdb513886663be1c8c12be3b403b71c9
2024-02-08 23:42:17 +01:00
Neels Hofmeyr e38f1ebc71 add comment in codec_mapping.c
Related: OS#6258
Change-Id: I0905a1264cd8f940c7a9964addf241091425fe72
2023-12-13 01:52:22 +00:00
Neels Hofmeyr cefe594c72 add sdp_audio_codec_to_speech_codec_list()
Used by I8760feaa8598047369ef8c3ab2673013bac8ac8a to add just a single
codec to a speech codec list, instead of a list.

Change-Id: I6ac23c54bc26939e048ff2df06eb987421cfb1c5
2023-12-13 01:52:22 +00:00
Neels Hofmeyr ed226ed6e6 fix codec mapping for GSM-HR
The cfg bits are for AMR-HR, not GSM-HR. The function
gsm0808_enc_speech_codec_list2() will return -EINVAL when it encounters
GSM-HR with non-zero cfg bits.

It appears this mapping was never used before, and my testing of call
re-assignment to match MT's codecs (it allows more than just the
assigned codec, because it can re-assign) has uncovered this bug
via MSC_Tests.TC_ho_inter_msc_out. I don't fully understand all the
details why we didn't see this before; anyway, the fix is obvious.

Change-Id: I19cff847a0f618ad000d12c1df54c55ef2f79699
2023-11-17 04:38:09 +01:00
Vadim Yanitskiy 9145531d7f codec_mapping: codec_map[]: add missing speech codec for CLEARMODE
Without the gsm0808_speech_codec functions:

* codec_mapping_by_gsm0808_speech_codec_type(), and
* codec_mapping_by_gsm0808_speech_codec()

fail to find the codec mapping for CLEARMODE.

Change-Id: I87b3aedaf7ff7bbbcb381e94158566dc765e3ae6
Related: OS#6110, OS#4394
2023-07-25 18:56:20 +07:00
Oliver Smith b4b9ec805a codec_mapping: add clearmode
Related: OS#4394
Change-Id: Ieeaca6a00dc332424d443e44251f3219245511db
2023-06-15 10:29:29 +02:00
Vadim Yanitskiy 999a593efb copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
Change-Id: I81687235fedcbbb686db7def59318e891e00ced7
2023-05-18 17:22:26 +07:00
Neels Hofmeyr b2ce74829a add codec_mapping.h,c
Converting between different codec representations is confusing. This
codec mapping provides a consolidated overview of all our codec
representations, and how they match up.

In particular, it adds the SDP codec representation repertoire,
preparing the use of full SDP on the MNCC interface.

Related: SYS#5066
Change-Id: Iaa307be6a8487aa8d4ba7cd59d5c5ef04818a744
2023-03-14 22:41:52 +00:00