[asterisk-commits] core: Add VP9 passthrough support. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 25 11:11:45 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/6079 )

Change subject: core: Add VP9 passthrough support.
......................................................................

core: Add VP9 passthrough support.

This change adds VP9 as a known codec and creates a cached
"vp9" media format for use.

Change-Id: I025a93ed05cf96153d66f36db1839109cc24c5cc
---
M CHANGES
M channels/chan_pjsip.c
M include/asterisk/format_cache.h
M main/codec_builtin.c
M main/format_cache.c
M main/rtp_engine.c
6 files changed, 32 insertions(+), 2 deletions(-)

Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve
  Matthew Fredrickson: Looks good to me, approved
  Joshua Colp: Approved for Submit



diff --git a/CHANGES b/CHANGES
index c7d801d..6407d13 100644
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,11 @@
 --- Functionality changes from Asterisk 13.17.0 to Asterisk 13.18.0 ----------
 ------------------------------------------------------------------------------
 
+Core
+------------------
+ * VP9 is now a supported passthrough video codec and it can be used by
+   specifying "vp9" in the allow line.
+
 res_musiconhold
 ------------------
  * By default, when res_musiconhold reloads or unloads, it sends a HUP signal
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index e2fd13c..c542e14 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -1376,7 +1376,8 @@
 			/* FIXME: Only use this for VP8. Additional work would have to be done to
 			 * fully support other video codecs */
 
-			if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), ast_format_vp8) != AST_FORMAT_CMP_NOT_EQUAL) {
+			if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), ast_format_vp8) != AST_FORMAT_CMP_NOT_EQUAL ||
+				ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), ast_format_vp9) != AST_FORMAT_CMP_NOT_EQUAL) {
 				/* FIXME Fake RTP write, this will be sent as an RTCP packet. Ideally the
 				 * RTP engine would provide a way to externally write/schedule RTCP
 				 * packets */
diff --git a/include/asterisk/format_cache.h b/include/asterisk/format_cache.h
index ff03bb4..d716cea 100644
--- a/include/asterisk/format_cache.h
+++ b/include/asterisk/format_cache.h
@@ -184,6 +184,11 @@
 extern struct ast_format *ast_format_vp8;
 
 /*!
+ * \brief Built-in cached vp9 format.
+ */
+extern struct ast_format *ast_format_vp9;
+
+/*!
  * \brief Built-in cached jpeg format.
  */
 extern struct ast_format *ast_format_jpeg;
diff --git a/main/codec_builtin.c b/main/codec_builtin.c
index 5fdfa7e..9ba33ee 100644
--- a/main/codec_builtin.c
+++ b/main/codec_builtin.c
@@ -783,6 +783,13 @@
 	.sample_rate = 1000,
 };
 
+static struct ast_codec vp9 = {
+	.name = "vp9",
+	.description = "VP9 video",
+	.type = AST_MEDIA_TYPE_VIDEO,
+	.sample_rate = 1000,
+};
+
 static struct ast_codec t140red = {
 	.name = "red",
 	.description = "T.140 Realtime Text with redundancy",
@@ -922,6 +929,7 @@
 	res |= CODEC_REGISTER_AND_CACHE(h264);
 	res |= CODEC_REGISTER_AND_CACHE(mpeg4);
 	res |= CODEC_REGISTER_AND_CACHE(vp8);
+	res |= CODEC_REGISTER_AND_CACHE(vp9);
 	res |= CODEC_REGISTER_AND_CACHE(t140red);
 	res |= CODEC_REGISTER_AND_CACHE(t140);
 	res |= CODEC_REGISTER_AND_CACHE(none);
diff --git a/main/format_cache.c b/main/format_cache.c
index 74ebfe8..00563e8 100644
--- a/main/format_cache.c
+++ b/main/format_cache.c
@@ -193,6 +193,11 @@
 struct ast_format *ast_format_vp8;
 
 /*!
+ * \brief Built-in cached vp9 format.
+ */
+struct ast_format *ast_format_vp9;
+
+/*!
  * \brief Built-in cached jpeg format.
  */
 struct ast_format *ast_format_jpeg;
@@ -336,6 +341,7 @@
 	ao2_replace(ast_format_h264, NULL);
 	ao2_replace(ast_format_mp4, NULL);
 	ao2_replace(ast_format_vp8, NULL);
+	ao2_replace(ast_format_vp9, NULL);
 	ao2_replace(ast_format_t140_red, NULL);
 	ao2_replace(ast_format_t140, NULL);
 	ao2_replace(ast_format_none, NULL);
@@ -432,6 +438,8 @@
 		ao2_replace(ast_format_mp4, format);
 	} else if (!strcmp(name, "vp8")) {
 		ao2_replace(ast_format_vp8, format);
+	} else if (!strcmp(name, "vp9")) {
+		ao2_replace(ast_format_vp9, format);
 	} else if (!strcmp(name, "red")) {
 		ao2_replace(ast_format_t140_red, format);
 	} else if (!strcmp(name, "t140")) {
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 3377087..11c1b93 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -2695,9 +2695,10 @@
 	set_next_mime_type(ast_format_siren7, 0, "audio", "G7221", 16000);
 	set_next_mime_type(ast_format_siren14, 0, "audio", "G7221", 32000);
 	set_next_mime_type(ast_format_g719, 0, "audio", "G719", 48000);
-	/* Opus and VP8 */
+	/* Opus, VP8, and VP9 */
 	set_next_mime_type(ast_format_opus, 0,  "audio", "opus", 48000);
 	set_next_mime_type(ast_format_vp8, 0,  "video", "VP8", 90000);
+	set_next_mime_type(ast_format_vp9, 0, "video", "VP9", 90000);
 
 	/* Define the static rtp payload mappings */
 	add_static_payload(0, ast_format_ulaw, 0);
@@ -2730,6 +2731,8 @@
 	add_static_payload(104, ast_format_mp4, 0);
 	add_static_payload(105, ast_format_t140_red, 0);   /* Real time text chat (with redundancy encoding) */
 	add_static_payload(106, ast_format_t140, 0);     /* Real time text chat */
+	add_static_payload(108, ast_format_vp9, 0);
+
 	add_static_payload(110, ast_format_speex, 0);
 	add_static_payload(111, ast_format_g726, 0);
 	add_static_payload(112, ast_format_g726_aal2, 0);

-- 
To view, visit https://gerrit.asterisk.org/6079
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I025a93ed05cf96153d66f36db1839109cc24c5cc
Gerrit-Change-Number: 6079
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170725/8cba70a2/attachment-0001.html>


More information about the asterisk-commits mailing list