mirror of https://gerrit.osmocom.org/libosmocore
fixup for gsm48_chan_mode_to_non_vamos()
When modifying chan modes, I first thought rather always fail if there is no equivalent mode. That is true for gsm48_chan_mode_to_vamos(), but for a change to non-VAMOS, rather return the unchanged mode for non-VAMOS modes, so that gsm48_chan_mode_to_non_vamos(GSM_CMODE_SIGN) works without failure. This makes more convenient checking, e.g. in osmo-bsc's lchan_fsm.c making sure that a non-VAMOS lchan has a non-VAMOS chan_mode, for all types of lchans. Change-Id: Ibf20f04d167e0e0599012ff530bc17ba8c8ab562
This commit is contained in:
parent
fc02ff459a
commit
208c5b643f
|
@ -463,22 +463,19 @@ enum gsm48_chan_mode gsm48_chan_mode_to_vamos(enum gsm48_chan_mode mode)
|
|||
}
|
||||
|
||||
/*! Translate GSM48_CMODE_SPEECH_*_VAMOS to its corresponding GSM48_CMODE_SPEECH_* non-vamos mode.
|
||||
* If the mode has no equivalent non-VAMOS mode, return a negative value.
|
||||
* If the mode is not a VAMOS mode, return the unchanged mode.
|
||||
*/
|
||||
enum gsm48_chan_mode gsm48_chan_mode_to_non_vamos(enum gsm48_chan_mode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case GSM48_CMODE_SPEECH_V1_VAMOS:
|
||||
case GSM48_CMODE_SPEECH_V1:
|
||||
return GSM48_CMODE_SPEECH_V1;
|
||||
case GSM48_CMODE_SPEECH_V2_VAMOS:
|
||||
case GSM48_CMODE_SPEECH_EFR:
|
||||
return GSM48_CMODE_SPEECH_EFR;
|
||||
case GSM48_CMODE_SPEECH_V3_VAMOS:
|
||||
case GSM48_CMODE_SPEECH_AMR:
|
||||
return GSM48_CMODE_SPEECH_AMR;
|
||||
default:
|
||||
return -1;
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue