--- main/format_cap.c (Asterisk 13.5.0) +++ main/format_cap.c (working copy) @@ -245,7 +245,10 @@ continue; } - format = ast_format_create(codec); + format = ast_format_cache_get(codec->name); + if (!format || (codec != ast_format_get_codec(format))) { + format = ast_format_create(codec); + } ao2_ref(codec, -1); if (!format) {