diff options
author | George Joseph <gjoseph@digium.com> | 2017-06-19 09:27:43 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-06-19 09:27:43 -0500 |
commit | 3f5bf287a20b7c613d0ff9db0e9c709fd639ccf1 (patch) | |
tree | 7d7d4501f560ae149cea5f55510860f79c397226 /main | |
parent | 317234bdc69f7ae179d962fabd82f2916e653a30 (diff) | |
parent | e563a1920e35b3986462dceadde5e162628adeb6 (diff) |
Merge "SDP: Add get/set option calls for RTP sched context per type."
Diffstat (limited to 'main')
-rw-r--r-- | main/sdp_options.c | 33 | ||||
-rw-r--r-- | main/sdp_private.h | 2 | ||||
-rw-r--r-- | main/sdp_state.c | 9 |
3 files changed, 37 insertions, 7 deletions
diff --git a/main/sdp_options.c b/main/sdp_options.c index ab8fb2973..a938583c6 100644 --- a/main/sdp_options.c +++ b/main/sdp_options.c @@ -77,6 +77,39 @@ DEFINE_GETTERS_SETTERS_FOR(enum ast_sdp_options_impl, impl); DEFINE_GETTERS_SETTERS_FOR(enum ast_sdp_options_encryption, encryption); DEFINE_GETTERS_SETTERS_FOR(unsigned int, ssrc); +struct ast_sched_context *ast_sdp_options_get_sched_type(const struct ast_sdp_options *options, enum ast_media_type type) +{ + struct ast_sched_context *sched = NULL; + + switch (type) { + case AST_MEDIA_TYPE_AUDIO: + case AST_MEDIA_TYPE_VIDEO: + case AST_MEDIA_TYPE_IMAGE: + case AST_MEDIA_TYPE_TEXT: + sched = options->sched[type]; + break; + case AST_MEDIA_TYPE_UNKNOWN: + case AST_MEDIA_TYPE_END: + break; + } + return sched; +} + +void ast_sdp_options_set_sched_type(struct ast_sdp_options *options, enum ast_media_type type, struct ast_sched_context *sched) +{ + switch (type) { + case AST_MEDIA_TYPE_AUDIO: + case AST_MEDIA_TYPE_VIDEO: + case AST_MEDIA_TYPE_IMAGE: + case AST_MEDIA_TYPE_TEXT: + options->sched[type] = sched; + break; + case AST_MEDIA_TYPE_UNKNOWN: + case AST_MEDIA_TYPE_END: + break; + } +} + static void set_defaults(struct ast_sdp_options *options) { options->dtmf = DEFAULT_DTMF; diff --git a/main/sdp_private.h b/main/sdp_private.h index a0b63df03..62228a5c8 100644 --- a/main/sdp_private.h +++ b/main/sdp_private.h @@ -35,6 +35,8 @@ struct ast_sdp_options { /*! RTP Engine Name */ AST_STRING_FIELD(rtp_engine); ); + /*! Scheduler context for the media stream types (Mainly for RTP) */ + struct ast_sched_context *sched[AST_MEDIA_TYPE_END]; struct { unsigned int rtp_symmetric:1; unsigned int udptl_symmetric:1; diff --git a/main/sdp_state.c b/main/sdp_state.c index 0f06bf9e3..99421ad4d 100644 --- a/main/sdp_state.c +++ b/main/sdp_state.c @@ -151,12 +151,6 @@ static void sdp_state_capabilities_free(struct sdp_state_capabilities *capabilit ast_free(capabilities); } -/* TODO - * This isn't set anywhere yet. - */ -/*! \brief Scheduler for RTCP purposes */ -static struct ast_sched_context *sched; - /*! \brief Internal function which creates an RTP instance */ static struct sdp_state_rtp *create_rtp(const struct ast_sdp_options *options, enum ast_media_type media_type) @@ -185,7 +179,8 @@ static struct sdp_state_rtp *create_rtp(const struct ast_sdp_options *options, return NULL; } - rtp->instance = ast_rtp_instance_new(options->rtp_engine, sched, media_address, NULL); + rtp->instance = ast_rtp_instance_new(options->rtp_engine, + ast_sdp_options_get_sched_type(options, media_type), media_address, NULL); if (!rtp->instance) { ast_log(LOG_ERROR, "Unable to create RTP instance using RTP engine '%s'\n", options->rtp_engine); |