diff options
-rw-r--r-- | modules/mpa/encode.c | 2 | ||||
-rw-r--r-- | src/audio.c | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/modules/mpa/encode.c b/modules/mpa/encode.c index 6ed6493..4e35ebe 100644 --- a/modules/mpa/encode.c +++ b/modules/mpa/encode.c @@ -63,7 +63,7 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac, prm.samplerate = 32000; prm.bitrate = 128000; prm.layer = 2; - prm.mode = SINGLE_CHANNEL; + prm.mode = SINGLE_CHANNEL; mpa_decode_fmtp(&prm, fmtp); result = 0; diff --git a/src/audio.c b/src/audio.c index 47b4c36..d862e89 100644 --- a/src/audio.c +++ b/src/audio.c @@ -248,11 +248,17 @@ static inline uint32_t get_srate(const struct aucodec *ac) if (!ac) return 0; - return !str_casecmp(ac->name, "G722") ? 16000 : !str_casecmp(ac->name, "MPA") ? 48000 : ac->srate; + if (!str_casecmp(ac->name, "G722")) + return 16000; + else if (!str_casecmp(ac->name, "MPA")) + return 48000; + else + return ac->srate; } + /** - * Get the DSP samplerate for an audio-codec (exception for G.722) + * Get the DSP samplerate for an audio-codec (exception for MPA) */ static inline uint32_t get_ch(const struct aucodec *ac) { @@ -346,7 +352,8 @@ static void encode_rtp_send(struct audio *a, struct autx *tx, /* The RTP clock rate used for generating the RTP timestamp is * independent of the number of channels and the encoding */ - frame_size = (tx->is_g722 ? sampc/2 : tx->is_mpa ? sampc*90/48 : sampc) / get_ch(tx->ac); + frame_size = (tx->is_g722 ? sampc/2 : + tx->is_mpa ? sampc*90/48 : sampc) / get_ch(tx->ac); tx->ts += (uint32_t)frame_size; @@ -1383,7 +1390,8 @@ static int aucodec_print(struct re_printf *pf, const struct aucodec *ac) if (!ac) return 0; - return re_hprintf(pf, "%s %uHz/%dch", ac->name, get_srate(ac), get_ch(ac)); + return re_hprintf(pf, "%s %uHz/%dch", + ac->name, get_srate(ac), get_ch(ac)); } |