summaryrefslogtreecommitdiff
path: root/main/codec.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2017-03-21 15:44:44 -0500
committerRichard Mudgett <rmudgett@digium.com>2017-04-25 13:03:33 -0500
commit32b3e36c683da0cea37a01c006037ff31f8a2b1d (patch)
tree24942142d9e821f99645c174ff626b49a0178f46 /main/codec.c
parent59203c51cc6a9676ef1ab42aebe070a55f55ead2 (diff)
SDP: Ensure SDPs "merge" properly.
The gist of this work ensures that when a remote SDP is received, it is merged properly with the local capabilities. The remote SDP is converted into a stream topology. That topology is then merged with the current local topology on the SDP state. That new merged topology is then used to create an SDP. Finally, adjustments are made to RTP instances based on knowledge gained from the remote SDP. There are also a battery of tests in this commit that ensure that some basic SDP merges work as expected. While this may not sound like a big change, it has the property that it caused lots of ancillary changes. * The remote SDP is no longer stored on the SDP state. Biggest reason: there's no need for it. The remote SDP is used at the time it is being set and nowhere else. * Some new SDP APIs were added in order to find attributes and convert generic SDP attributes into rtpmap structures. * Writing tests made me realize that retrieving a value from an SDP options structure, the SDP options needs to be made const. * The SDP state machine was essentially gutted by a previous commit. Initially, I attempted to reinstate it, but I found that as it had been defined, it was not all that useful. What was more useful was knowing the role we play in SDP negotiation, so the SDP state machine has been transformed into an indicator of role. * Rather than storing separate local and joint stream state capabilities, it makes more sense to keep track of current stream state and update it as things change. Change-Id: I5938c2be3c6f0a003aa88a39a59e0880f8b2df3d
Diffstat (limited to 'main/codec.c')
-rw-r--r--main/codec.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/codec.c b/main/codec.c
index 1870c393b..7797147a7 100644
--- a/main/codec.c
+++ b/main/codec.c
@@ -376,6 +376,21 @@ const char *ast_codec_media_type2str(enum ast_media_type type)
}
}
+enum ast_media_type ast_media_type_from_str(const char *media_type_str)
+{
+ if (!strcasecmp(media_type_str, "audio")) {
+ return AST_MEDIA_TYPE_AUDIO;
+ } else if (!strcasecmp(media_type_str, "video")) {
+ return AST_MEDIA_TYPE_VIDEO;
+ } else if (!strcasecmp(media_type_str, "image")) {
+ return AST_MEDIA_TYPE_IMAGE;
+ } else if (!strcasecmp(media_type_str, "text")) {
+ return AST_MEDIA_TYPE_TEXT;
+ } else {
+ return AST_MEDIA_TYPE_UNKNOWN;
+ }
+}
+
unsigned int ast_codec_samples_count(struct ast_frame *frame)
{
struct ast_codec *codec;