diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index f009943ed9a719ad12088b3f43213cb6186ee13d..51b5dab5cbcdf290dbbac1e7bf0782666795f15a 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -1596,6 +1596,7 @@ static int chan_pjsip_indicate(struct ast_channel *ast, int condition, const voi * fully support other video codecs */ 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 || (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/include/asterisk/format_cache.h b/include/asterisk/format_cache.h index 92272e8ebac3ee6dda2576016719eaf3914fa41c..067546310ff58164090008d5dc662d406d7f9dcf 100644 --- a/include/asterisk/format_cache.h +++ b/include/asterisk/format_cache.h @@ -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. */ diff --git a/main/codec_builtin.c b/main/codec_builtin.c index 32ec12d3d428fcd69ddff73ea7533c58b166f8f5..25aa51384b501f55e7d8e909a4dc24e07203012a 100644 --- a/main/codec_builtin.c +++ b/main/codec_builtin.c @@ -820,6 +820,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", @@ -966,6 +973,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(t38); diff --git a/main/format_cache.c b/main/format_cache.c index 302bbf827e73866a830a2ce46e1fafc2f18516ac..1a67ebe6088431b1b3dc28917571a1d73a93be2a 100644 --- a/main/format_cache.c +++ b/main/format_cache.c @@ -190,6 +190,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. */ @@ -345,6 +350,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_t38, NULL); @@ -444,6 +450,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")) { diff --git a/main/rtp_engine.c b/main/rtp_engine.c index abd4b1fcfcaa9ddcfbd48a3830451a44190524a9..fe60c4eae2b7f71bf61862fc3c7d8b4314f82c04 100644 --- a/main/rtp_engine.c +++ b/main/rtp_engine.c @@ -3268,9 +3268,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); @@ -3311,6 +3312,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); @@ -3413,4 +3415,4 @@ void ast_rtp_instance_set_stream_num(struct ast_rtp_instance *rtp, int stream_nu rtp->engine->set_stream_num(rtp, stream_num); } ao2_unlock(rtp); -} \ No newline at end of file +}