]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
core: Add VP9 passthrough support.
authorJoshua Colp <jcolp@digium.com>
Mon, 24 Jul 2017 18:30:59 +0000 (18:30 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 24 Jul 2017 18:51:01 +0000 (18:51 +0000)
This change adds VP9 as a known codec and creates a cached
"vp9" media format for use.

Change-Id: I025a93ed05cf96153d66f36db1839109cc24c5cc

CHANGES
channels/chan_pjsip.c
include/asterisk/format_cache.h
main/codec_builtin.c
main/format_cache.c
main/rtp_engine.c

diff --git a/CHANGES b/CHANGES
index 5907e13d23c5f7b4967eae83b82c2f19ca3715cc..18248c080f9700b2b33fc60c9518a1992958a429 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 --- Functionality changes from Asterisk 14.6.0 to Asterisk 14.7.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
index 6a11b598fedf3ce64e3b450e5037a3c1773942bc..ad798f4a39bd89abfbae358e4aeb32b798525bfa 100644 (file)
@@ -1409,7 +1409,8 @@ static int chan_pjsip_indicate(struct ast_channel *ast, int condition, const voi
                        /* 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 */
index 3894ad21bcc2c401020e83bae923efadf6a19cef..21e5c5187d11702919289adefcc9bef160298263 100644 (file)
@@ -183,6 +183,11 @@ extern struct ast_format *ast_format_mp4;
  */
 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.
  */
index 96868e674a7f7f0a4cf2260eaf04907ee9115cfe..3f0fdf1486860fce6d699c13534edc95da88f79d 100644 (file)
@@ -789,6 +789,13 @@ static struct ast_codec vp8 = {
        .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",
@@ -928,6 +935,7 @@ int ast_codec_builtin_init(void)
        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);
index b4d426092510cdb1ede8d567a58b2b25dc782e8f..39685e4af698ef18971955aba322754caa01fc6f 100644 (file)
@@ -192,6 +192,11 @@ struct ast_format *ast_format_mp4;
  */
 struct ast_format *ast_format_vp8;
 
+/*!
+ * \brief Built-in cached vp9 format.
+ */
+struct ast_format *ast_format_vp9;
+
 /*!
  * \brief Built-in cached jpeg format.
  */
@@ -336,6 +341,7 @@ static void format_cache_shutdown(void)
        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 @@ static void set_cached_format(const char *name, struct ast_format *format)
                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")) {
index 23995a1a3ac21c87fdb1afb74aafbdd43a4a59f4..8d6c337a48b252b6d5f489d09a0aa87b580e7d86 100644 (file)
@@ -3252,9 +3252,10 @@ int ast_rtp_engine_init(void)
        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);
@@ -3295,6 +3296,7 @@ int ast_rtp_engine_init(void)
        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(107, ast_format_opus, 0);
+       add_static_payload(108, ast_format_vp9, 0);
 
        add_static_payload(110, ast_format_speex, 0);
        add_static_payload(111, ast_format_g726, 0);