[Asterisk-code-review] SDP: Add get/set option calls for RTP sched context per type. (asterisk[master])
George Joseph
asteriskteam at digium.com
Mon Jun 19 09:27:43 CDT 2017
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/5818 )
Change subject: SDP: Add get/set option calls for RTP sched context per type.
......................................................................
SDP: Add get/set option calls for RTP sched context per type.
Change-Id: I82dc75c63c48904e9e5a49e2205dcc06e88487e4
---
M include/asterisk/sdp_options.h
M main/sdp_options.c
M main/sdp_private.h
M main/sdp_state.c
4 files changed, 62 insertions(+), 7 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/include/asterisk/sdp_options.h b/include/asterisk/sdp_options.h
index f49b794..b8c1bbd 100644
--- a/include/asterisk/sdp_options.h
+++ b/include/asterisk/sdp_options.h
@@ -522,4 +522,29 @@
*/
unsigned int ast_sdp_options_get_ssrc(const struct ast_sdp_options *options);
+/*!
+ * \brief Set the SDP options scheduler context used to create new streams of the type.
+ * \since 15.0.0
+ *
+ * \param options SDP Options
+ * \param type Media type the scheduler context is for.
+ * \param sched Scheduler context to use for the specified media type.
+ *
+ * \return Nothing
+ */
+void ast_sdp_options_set_sched_type(struct ast_sdp_options *options,
+ enum ast_media_type type, struct ast_sched_context *sched);
+
+/*!
+ * \brief Get the SDP options scheduler context used to create new streams of the type.
+ * \since 15.0.0
+ *
+ * \param options SDP Options
+ * \param type Media type the format cap represents.
+ *
+ * \return The stored scheduler context to create new streams of the type.
+ */
+struct ast_sched_context *ast_sdp_options_get_sched_type(const struct ast_sdp_options *options,
+ enum ast_media_type type);
+
#endif /* _ASTERISK_SDP_OPTIONS_H */
diff --git a/main/sdp_options.c b/main/sdp_options.c
index ab8fb29..a938583 100644
--- a/main/sdp_options.c
+++ b/main/sdp_options.c
@@ -77,6 +77,39 @@
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 a0b63df..62228a5 100644
--- a/main/sdp_private.h
+++ b/main/sdp_private.h
@@ -35,6 +35,8 @@
/*! 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 0f06bf9..99421ad 100644
--- a/main/sdp_state.c
+++ b/main/sdp_state.c
@@ -151,12 +151,6 @@
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 @@
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);
--
To view, visit https://gerrit.asterisk.org/5818
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I82dc75c63c48904e9e5a49e2205dcc06e88487e4
Gerrit-Change-Number: 5818
Gerrit-PatchSet: 2
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170619/56fefc9f/attachment-0001.html>
More information about the asterisk-code-review
mailing list