Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.
/ kms-core Public archive

Adds SPEEX codec support to RTPEndpoint. Fitted for 6.5.0 #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/gst-plugins/commons/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ G_BEGIN_DECLS
/* RTP enconding names */
#define OPUS_ENCONDING_NAME "OPUS"
#define VP8_ENCONDING_NAME "VP8"
#define SPEEX_ENCONDING_NAME "speex"

G_END_DECLS
#endif /* __KMS_CONSTANTS_H__ */
10 changes: 10 additions & 0 deletions src/gst-plugins/commons/kmsenctreebin.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ typedef enum
X264,
OPENH264,
OPUS,
SPEEX,
UNSUPPORTED
} EncoderType;

Expand Down Expand Up @@ -77,6 +78,8 @@ kms_enc_tree_bin_get_name_from_type (EncoderType enc_type)
return "openh264";
case OPUS:
return "opus";
case SPEEX:
return "speex";
case UNSUPPORTED:
default:
return NULL;
Expand Down Expand Up @@ -183,6 +186,11 @@ configure_encoder (GstElement * encoder, EncoderType type, gint target_bitrate,
"perfect-timestamp", TRUE, NULL);
break;
}
case SPEEX:
{
g_object_set (G_OBJECT (encoder), "complexity", 4, NULL);
break;
}
default:
GST_DEBUG ("Codec %" GST_PTR_FORMAT
" not configured because it is not supported", encoder);
Expand All @@ -207,6 +215,8 @@ kms_enc_tree_bin_set_encoder_type (KmsEncTreeBin * self)
self->priv->enc_type = OPENH264;
} else if (g_str_has_prefix (name, "opusenc")) {
self->priv->enc_type = OPUS;
} else if (g_str_has_prefix (name, "speexenc")) {
self->priv->enc_type = SPEEX;
} else {
self->priv->enc_type = UNSUPPORTED;
}
Expand Down
3 changes: 3 additions & 0 deletions src/gst-plugins/commons/kmsutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ kms_utils_get_caps_codec_name_from_sdp (const gchar * codec_name)
if (g_ascii_strcasecmp (VP8_ENCONDING_NAME, codec_name) == 0) {
return "VP8";
}
if (g_ascii_strcasecmp (SPEEX_ENCONDING_NAME, codec_name) == 0) {
return "SPEEX";
}

return codec_name;
}
Expand Down
3 changes: 3 additions & 0 deletions src/server/config/SdpEndpoint.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
},
{
"name" : "AMR/8000"
},
{
"name" : "speex/16000"
}
],
"videoCodecs" : [
Expand Down
4 changes: 4 additions & 0 deletions src/server/implementation/objects/MediaElementImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,10 @@ void MediaElementImpl::setAudioFormat (std::shared_ptr<AudioCaps> caps)
str_caps = "audio/x-raw";
break;

case AudioCodec::SPEEX:
str_caps = "audio/x-speex";
break;

default:
throw KurentoException (MEDIA_OBJECT_ILLEGAL_PARAM_ERROR,
"Invalid parameter provided: " + codec->getString() );
Expand Down
3 changes: 2 additions & 1 deletion src/server/interface/core.kmd.json
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@
"values": [
"OPUS",
"PCMU",
"RAW"
"RAW",
"SPEEX"
],
"name": "AudioCodec",
"doc": "Codec used for transmission of audio."
Expand Down