only first AMR mode-set wip
Change-Id: I66d7822357648c5eb8e2edf27f4f6ce31f4091b4
This commit is contained in:
parent
e72a58d4bf
commit
d70e0e355f
|
@ -357,29 +357,39 @@ static uint32_t gsm0808_cfg_to_rab_modes(bool full_rate, uint16_t cfg)
|
||||||
return rab_modes;
|
return rab_modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Combine all the AMR cfg bits across the codecs */
|
static const struct sdp_audio_codec *first_amr(const struct sdp_audio_codecs *codecs)
|
||||||
|
{
|
||||||
|
const struct sdp_audio_codec *c;
|
||||||
|
sdp_audio_codecs_foreach (c, codecs) {
|
||||||
|
if (!strcmp("AMR", c->subtype_name))
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the RAB modes (AMR rates) from the first AMR codec in this list */
|
||||||
static uint32_t codecs_to_rab_modes(const struct sdp_audio_codecs *codecs)
|
static uint32_t codecs_to_rab_modes(const struct sdp_audio_codecs *codecs)
|
||||||
{
|
{
|
||||||
|
const struct sdp_audio_codec *c;
|
||||||
struct gsm0808_speech_codec_list scl = {};
|
struct gsm0808_speech_codec_list scl = {};
|
||||||
int i;
|
int i;
|
||||||
uint32_t rab_modes = 0;
|
uint32_t rab_modes = 0;
|
||||||
sdp_audio_codecs_to_speech_codec_list(&scl, codecs);
|
c = first_amr(codecs);
|
||||||
|
if (!c)
|
||||||
|
return 0;
|
||||||
|
sdp_audio_codec_to_speech_codec_list(&scl, c);
|
||||||
for (i = 0; i < scl.len; i++) {
|
for (i = 0; i < scl.len; i++) {
|
||||||
bool amr = false;
|
|
||||||
bool fr = false;
|
bool fr = false;
|
||||||
switch (scl.codec[i].type) {
|
switch (scl.codec[i].type) {
|
||||||
case GSM0808_SCT_FR3:
|
case GSM0808_SCT_FR3:
|
||||||
amr = true;
|
|
||||||
fr = true;
|
fr = true;
|
||||||
break;
|
break;
|
||||||
case GSM0808_SCT_HR3:
|
case GSM0808_SCT_HR3:
|
||||||
amr = true;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (amr)
|
rab_modes |= gsm0808_cfg_to_rab_modes(fr, scl.codec[i].cfg);
|
||||||
rab_modes |= gsm0808_cfg_to_rab_modes(fr, scl.codec[i].cfg);
|
|
||||||
}
|
}
|
||||||
return rab_modes;
|
return rab_modes;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue