[Asterisk-code-review] core: Add H.265/HEVC passthrough support (...asterisk[17])

Florian Floimair asteriskteam at digium.com
Tue Sep 17 06:41:41 CDT 2019


Florian Floimair has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/12885


Change subject: core: Add H.265/HEVC passthrough support
......................................................................

core: Add H.265/HEVC passthrough support

This change adds H.265/HEVC as a known codec and creates a cached
"h265" media format for use.

Note that RFC 7798 section 7.2 also describes additional SDP
parameters. Handling of these is not yet supported.

ASTERISK-28512

Change-Id: I26d262cc4110b4f7e99348a3ddc53bad0d2cd1f2
---
M channels/chan_pjsip.c
A doc/CHANGES-staging/h265-passthrough.txt
M include/asterisk/format_cache.h
M main/codec_builtin.c
M main/format_cache.c
M main/rtp_engine.c
6 files changed, 30 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/85/12885/1

diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 0035a02..8abdfde 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -1648,6 +1648,7 @@
 
 				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 ||
+					ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), ast_format_h265) != AST_FORMAT_CMP_NOT_EQUAL ||
 					(channel->session->endpoint->media.webrtc &&
 					 ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), ast_format_h264) != AST_FORMAT_CMP_NOT_EQUAL)) {
 					/* FIXME Fake RTP write, this will be sent as an RTCP packet. Ideally the
diff --git a/doc/CHANGES-staging/h265-passthrough.txt b/doc/CHANGES-staging/h265-passthrough.txt
new file mode 100644
index 0000000..b2c449a
--- /dev/null
+++ b/doc/CHANGES-staging/h265-passthrough.txt
@@ -0,0 +1,6 @@
+Subject: Core
+
+H.265/HEVC is now a supported video codec and it can be used by
+specifying "h265" in the allow line.
+Please note however, that handling of the additional SDP parameters
+described in RFC 7798 section 7.2 is not yet supported.
diff --git a/include/asterisk/format_cache.h b/include/asterisk/format_cache.h
index 0675463..5a2add6 100644
--- a/include/asterisk/format_cache.h
+++ b/include/asterisk/format_cache.h
@@ -174,6 +174,11 @@
 extern struct ast_format *ast_format_h264;
 
 /*!
+ * \brief Built-in cached h265 format.
+ */
+extern struct ast_format *ast_format_h265;
+
+/*!
  * \brief Built-in cached mp4 format.
  */
 extern struct ast_format *ast_format_mp4;
diff --git a/main/codec_builtin.c b/main/codec_builtin.c
index 25aa513..ce65754 100644
--- a/main/codec_builtin.c
+++ b/main/codec_builtin.c
@@ -806,6 +806,13 @@
 	.sample_rate = 1000,
 };
 
+static struct ast_codec h265 = {
+	.name = "h265",
+	.description = "H.265 video",
+	.type = AST_MEDIA_TYPE_VIDEO,
+	.sample_rate = 1000,
+};
+
 static struct ast_codec mpeg4 = {
 	.name = "mpeg4",
 	.description = "MPEG4 video",
@@ -971,6 +978,7 @@
 	res |= CODEC_REGISTER_AND_CACHE(h263);
 	res |= CODEC_REGISTER_AND_CACHE(h263p);
 	res |= CODEC_REGISTER_AND_CACHE(h264);
+	res |= CODEC_REGISTER_AND_CACHE(h265);
 	res |= CODEC_REGISTER_AND_CACHE(mpeg4);
 	res |= CODEC_REGISTER_AND_CACHE(vp8);
 	res |= CODEC_REGISTER_AND_CACHE(vp9);
diff --git a/main/format_cache.c b/main/format_cache.c
index 95ad5ea..fbe659f 100644
--- a/main/format_cache.c
+++ b/main/format_cache.c
@@ -181,6 +181,11 @@
 struct ast_format *ast_format_h264;
 
 /*!
+ * \brief Built-in cached h265 format.
+ */
+struct ast_format *ast_format_h265;
+
+/*!
  * \brief Built-in cached mp4 format.
  */
 struct ast_format *ast_format_mp4;
@@ -348,6 +353,7 @@
 	ao2_replace(ast_format_h263, NULL);
 	ao2_replace(ast_format_h263p, NULL);
 	ao2_replace(ast_format_h264, NULL);
+	ao2_replace(ast_format_h265, NULL);
 	ao2_replace(ast_format_mp4, NULL);
 	ao2_replace(ast_format_vp8, NULL);
 	ao2_replace(ast_format_vp9, NULL);
@@ -446,6 +452,8 @@
 		ao2_replace(ast_format_h263p, format);
 	} else if (!strcmp(name, "h264")) {
 		ao2_replace(ast_format_h264, format);
+	} else if (!strcmp(name, "h265")) {
+		ao2_replace(ast_format_h265, format);
 	} else if (!strcmp(name, "mpeg4")) {
 		ao2_replace(ast_format_mp4, format);
 	} else if (!strcmp(name, "vp8")) {
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 3403d70..ac429ca 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -3611,6 +3611,7 @@
 	set_next_mime_type(ast_format_h263, 0, "video", "H263", 90000);
 	set_next_mime_type(ast_format_h263p, 0, "video", "h263-1998", 90000);
 	set_next_mime_type(ast_format_h264, 0, "video", "H264", 90000);
+	set_next_mime_type(ast_format_h265, 0, "video", "H265", 90000);
 	set_next_mime_type(ast_format_mp4, 0, "video", "MP4V-ES", 90000);
 	set_next_mime_type(ast_format_t140_red, 0, "text", "RED", 1000);
 	set_next_mime_type(ast_format_t140, 0, "text", "T140", 1000);
@@ -3662,6 +3663,7 @@
 	add_static_payload(106, ast_format_t140, 0);     /* Real time text chat */
 	add_static_payload(107, ast_format_opus, 0);
 	add_static_payload(108, ast_format_vp9, 0);
+	add_static_payload(109, ast_format_h265, 0);
 
 	add_static_payload(110, ast_format_speex, 0);
 	add_static_payload(111, ast_format_g726, 0);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12885
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 17
Gerrit-Change-Id: I26d262cc4110b4f7e99348a3ddc53bad0d2cd1f2
Gerrit-Change-Number: 12885
Gerrit-PatchSet: 1
Gerrit-Owner: Florian Floimair <f.floimair at commend.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190917/f299fa7e/attachment.html>


More information about the asterisk-code-review mailing list