From 82ff254845847574ed110c3ee2d13f64ed8fb380 Mon Sep 17 00:00:00 2001 From: Saul Pablo Labajo Izquierdo Date: Wed, 6 Nov 2024 18:05:31 +0000 Subject: [PATCH 1/7] initial implementation --- server/media-server/sdp_pattern.txt | 3 +- .../src/gst-plugins/commons/kmsagnosticcaps.h | 2 +- .../src/gst-plugins/commons/kmsenctreebin.c | 24 ++++++- .../sdpagent/kmssdprtpavpfmediahandler.c | 3 +- .../src/server/config/SdpEndpoint.conf.json | 1 + .../objects/MediaElementImpl.cpp | 4 ++ .../src/server/interface/core.kmd.json | 1 + .../src/server/config/WebRtcEndpoint.conf.ini | 7 +- .../objects/WebRtcEndpointImpl.cpp | 17 +++++ .../tests/check/element/webrtcendpoint.c | 72 +++++++++++++++++++ 10 files changed, 129 insertions(+), 5 deletions(-) diff --git a/server/media-server/sdp_pattern.txt b/server/media-server/sdp_pattern.txt index bde7d46bad..1132be3fc1 100644 --- a/server/media-server/sdp_pattern.txt +++ b/server/media-server/sdp_pattern.txt @@ -7,12 +7,13 @@ m=audio 0 RTP/AVP 98 99 0 a=rtpmap:98 OPUS/48000/2 a=rtpmap:99 AMR/8000/1 a=rtpmap:0 PCMU/8000 -m=video 0 RTP/AVP 96 97 101 98 100 102 +m=video 0 RTP/AVP 96 97 101 98 100 102 103 a=rtpmap:96 H263-1998/90000 a=rtpmap:97 VP8/90000 a=rtpmap:101 H264/90000 a=rtpmap:98 VP9/90000 a=rtpmap:100 MP4V-ES/90000 a=rtpmap:102 AV1/90000 +a=rtpmap:103 H265/90000 diff --git a/server/module-core/src/gst-plugins/commons/kmsagnosticcaps.h b/server/module-core/src/gst-plugins/commons/kmsagnosticcaps.h index c0a5d6cf52..4a1018b938 100644 --- a/server/module-core/src/gst-plugins/commons/kmsagnosticcaps.h +++ b/server/module-core/src/gst-plugins/commons/kmsagnosticcaps.h @@ -120,7 +120,7 @@ "video/x-theora;" \ "video/x-h264;" \ "video/x-gst_ff-libxvid;" \ - "video/x-h264;" \ + "video/x-h265;" \ "video/x-xvid;" \ "video/mpeg,mpegversion=[1, 2];" \ "video/x-theora;" \ diff --git a/server/module-core/src/gst-plugins/commons/kmsenctreebin.c b/server/module-core/src/gst-plugins/commons/kmsenctreebin.c index f278ea9dbe..ff1e9bc306 100644 --- a/server/module-core/src/gst-plugins/commons/kmsenctreebin.c +++ b/server/module-core/src/gst-plugins/commons/kmsenctreebin.c @@ -43,6 +43,7 @@ G_DEFINE_TYPE (KmsEncTreeBin, kms_enc_tree_bin, KMS_TYPE_TREE_BIN); typedef enum { + X265, AV1, VP9, VP8, @@ -70,6 +71,8 @@ static const gchar * kms_enc_tree_bin_get_name_from_type (EncoderType enc_type) { switch (enc_type) { + case X265: + return "x265"; case AV1: return "av1"; case VP9: @@ -145,6 +148,17 @@ configure_encoder (GstElement * encoder, EncoderType type, { GST_DEBUG ("Configure encoder: %" GST_PTR_FORMAT, encoder); switch (type) { + case X265: + { + /* *INDENT-OFF* */ + g_object_set (G_OBJECT (encoder), + "speed-preset", /* veryfast */ 3, + "key-int-max", 60, + "tune", /* zero-latency */ 4, + NULL); + /* *INDENT-ON* */ + break; + } case AV1: { /* *INDENT-OFF* */ @@ -229,7 +243,9 @@ kms_enc_tree_bin_set_encoder_type (KmsEncTreeBin * self) g_object_get (self->priv->enc, "name", &name, NULL); - if (g_str_has_prefix (name, "vp8enc")) { + if (g_str_has_prefix (name, "x265enc")) { + self->priv->enc_type = X265; + } else if (g_str_has_prefix (name, "vp8enc")) { self->priv->enc_type = VP8; } else if (g_str_has_prefix (name, "vp9enc")) { self->priv->enc_type = VP9; @@ -321,6 +337,7 @@ kms_enc_tree_bin_set_target_bitrate (KmsEncTreeBin *self) { const gchar *vpx_property_name = "target-bitrate"; const gchar *h264_property_name = "bitrate"; + const gchar *h265_property_name = "bitrate"; const gchar *property_name; gint new_bitrate = kms_enc_tree_bin_get_bitrate (self); @@ -331,6 +348,11 @@ kms_enc_tree_bin_set_target_bitrate (KmsEncTreeBin *self) } switch (self->priv->enc_type) { + case X265: + property_name = h265_property_name; + kbps_div = 1; + new_bitrate /= 1000; + break; case VP9: property_name = vpx_property_name; kbps_div = 1000; diff --git a/server/module-core/src/gst-plugins/commons/sdpagent/kmssdprtpavpfmediahandler.c b/server/module-core/src/gst-plugins/commons/sdpagent/kmssdprtpavpfmediahandler.c index 2d60df8666..e545c180b7 100644 --- a/server/module-core/src/gst-plugins/commons/sdpagent/kmssdprtpavpfmediahandler.c +++ b/server/module-core/src/gst-plugins/commons/sdpagent/kmssdprtpavpfmediahandler.c @@ -44,7 +44,8 @@ static gchar *video_rtcp_fb_enc[] = { "AV1", "VP9", "VP8", - "H264" + "H264", + "H265" }; #define KMS_SDP_RTP_AVPF_MEDIA_HANDLER_GET_PRIVATE(obj) ( \ diff --git a/server/module-core/src/server/config/SdpEndpoint.conf.json b/server/module-core/src/server/config/SdpEndpoint.conf.json index 22f99bd4f6..a0c96cf062 100644 --- a/server/module-core/src/server/config/SdpEndpoint.conf.json +++ b/server/module-core/src/server/config/SdpEndpoint.conf.json @@ -18,6 +18,7 @@ { "name": "AMR/8000" } ], "videoCodecs": [ + { "name": "H265/90000" } { "name": "AV1/90000" }, { "name": "VP9/90000" }, { "name": "VP8/90000" }, diff --git a/server/module-core/src/server/implementation/objects/MediaElementImpl.cpp b/server/module-core/src/server/implementation/objects/MediaElementImpl.cpp index 8593cbb842..db33ccd859 100644 --- a/server/module-core/src/server/implementation/objects/MediaElementImpl.cpp +++ b/server/module-core/src/server/implementation/objects/MediaElementImpl.cpp @@ -1220,6 +1220,10 @@ void MediaElementImpl::setVideoFormat (std::shared_ptr caps) fraction = caps->getFramerate(); switch (codec->getValue() ) { + case VideoCodec::H265: + str_caps = "video/x-h265"; + break; + case VideoCodec::AV1: str_caps = "video/x-av1"; break; diff --git a/server/module-core/src/server/interface/core.kmd.json b/server/module-core/src/server/interface/core.kmd.json index 8cc5be40ba..4a575fcd5c 100644 --- a/server/module-core/src/server/interface/core.kmd.json +++ b/server/module-core/src/server/interface/core.kmd.json @@ -1599,6 +1599,7 @@ Pipeline, towards the associated producer. Only valid for video consumers. { "typeFormat": "ENUM", "values": [ + "H265", "AV1", "VP9", "VP8", diff --git a/server/module-elements/src/server/config/WebRtcEndpoint.conf.ini b/server/module-elements/src/server/config/WebRtcEndpoint.conf.ini index 5fbe2c7a19..26939f8554 100644 --- a/server/module-elements/src/server/config/WebRtcEndpoint.conf.ini +++ b/server/module-elements/src/server/config/WebRtcEndpoint.conf.ini @@ -151,4 +151,9 @@ ;; requested on client, unfortunately for traffic on the other direction, this must be requested to the ;; browser or client. On browser, the client application needs to use the following API ;; https://www.w3.org/TR/webrtc-priority/ -;qos-dscp=AUDIO_HIGH \ No newline at end of file +;qos-dscp=AUDIO_HIGH + +; Enable/Diable H265 support. It is disabled by default, enabling it implies that the user or administrator is responsible +; for H265 royalties that may be needed to use this codec. Kurento team will never be responsible for any unatuorhized use of +; patent protected codecs +;enable-h265=false \ No newline at end of file diff --git a/server/module-elements/src/server/implementation/objects/WebRtcEndpointImpl.cpp b/server/module-elements/src/server/implementation/objects/WebRtcEndpointImpl.cpp index ae3e43b0c2..3a146a6844 100644 --- a/server/module-elements/src/server/implementation/objects/WebRtcEndpointImpl.cpp +++ b/server/module-elements/src/server/implementation/objects/WebRtcEndpointImpl.cpp @@ -69,6 +69,8 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); #define PARAM_QOS_DSCP "qos-dscp" +#define PARAM_ENABLE_H265 "enable-h265" + namespace kurento { @@ -133,6 +135,12 @@ remove_not_supported_codecs (GstElement *element) g_array_unref (codecs); } +static void +add_support_for_h265 () +{ + supported_codecs.emplace_back("H265"); +} + static void check_support_for_h264 () { @@ -631,6 +639,15 @@ WebRtcEndpointImpl::WebRtcEndpointImpl (const boost::property_tree::ptree &conf, std::call_once (certificates_flag, std::bind (&WebRtcEndpointImpl::generateDefaultCertificates, this) ); + std::string enableH265; + + if (getConfigValue(&cfg_dscp_value, PARAM_ENABLE_H265)) { + GST_INFO ("ENABLE-H265 configured value is %s", enableH265.c_str()); + if (enableH265 == "true") { + add_support_for_h265 (); + } + } + this->qosDscp = qosDscp; if (qosDscp->getValue () == DSCPValue::NO_VALUE) { std::string cfg_dscp_value; diff --git a/server/module-elements/tests/check/element/webrtcendpoint.c b/server/module-elements/tests/check/element/webrtcendpoint.c index d70ae1bf72..d3348a11a1 100644 --- a/server/module-elements/tests/check/element/webrtcendpoint.c +++ b/server/module-elements/tests/check/element/webrtcendpoint.c @@ -1773,10 +1773,24 @@ GST_START_TEST (test_webrtc_data_channel) GST_END_TEST /* Video tests */ +static GstStaticCaps h265_expected_caps = GST_STATIC_CAPS ("video/x-h265"); static GstStaticCaps vp8_expected_caps = GST_STATIC_CAPS ("video/x-vp8"); static GstStaticCaps vp9_expected_caps = GST_STATIC_CAPS ("video/x-vp9"); static GstStaticCaps av1_expected_caps = GST_STATIC_CAPS ("video/x-av1"); +GST_START_TEST (test_h265_sendonly_recvonly) +{ + test_video_sendonly ("x265enc", h265_expected_caps, "H265/90000", FALSE, FALSE, + FALSE, NULL); + test_video_sendonly ("x265enc", h265_expected_caps, "H265/90000", TRUE, FALSE, + FALSE, NULL); + test_video_sendonly ("x265enc", h265_expected_caps, "H265/90000", TRUE, TRUE, + FALSE, NULL); + test_video_sendonly ("x265enc", h265_expected_caps, "H265/90000", TRUE, FALSE, + TRUE, NULL); +} +GST_END_TEST + GST_START_TEST (test_vp8_sendonly_recvonly) { test_video_sendonly ("vp8enc", vp8_expected_caps, "VP8/90000", FALSE, FALSE, @@ -1861,6 +1875,13 @@ const gchar *rsa_pem = "-----BEGIN PRIVATE KEY-----\r\n" "bqedNYytvSmEQGEuwlwtA0fNAetr5x7Qegfl4vTWTKogna1xm7SSYqNeOYJZYauV\r\n" "1E1yY33Cjjz/BFBW6lqcl6ryeqzTwg/GXXGW\r\n" "-----END CERTIFICATE-----"; +GST_START_TEST (test_h265_sendonly_recvonly_rsa) +{ + test_video_sendonly ("x265enc", h265_expected_caps, "H265/90000", FALSE, FALSE, + FALSE, rsa_pem); +} +GST_END_TEST + GST_START_TEST (test_vp8_sendonly_recvonly_rsa) { test_video_sendonly ("vp8enc", vp8_expected_caps, "VP8/90000", FALSE, FALSE, @@ -1901,6 +1922,13 @@ const gchar *ecdsa_pem = "-----BEGIN EC PARAMETERS-----\r\n" "6oZzJ6SPfJfJXi5PrOdDDQxhR/aKoxzDbY2SRQIhAL78PAvG56DmpXU2cLTaDlIp\r\n" "zjhIHfiZIzPxTHr129TE\r\n" "-----END CERTIFICATE-----"; +GST_START_TEST (test_h265_sendonly_recvonly_ecdsa) +{ + test_video_sendonly ("x265enc", h265_expected_caps, "H265/90000", FALSE, FALSE, + FALSE, ecdsa_pem); +} +GST_END_TEST + GST_START_TEST (test_vp8_sendonly_recvonly_ecdsa) { test_video_sendonly ("vp8enc", vp8_expected_caps, "VP8/90000", FALSE, FALSE, @@ -1922,6 +1950,14 @@ GST_START_TEST (test_av1_sendonly_recvonly_ecdsa) } GST_END_TEST +GST_START_TEST (test_h265_sendrecv) +{ + test_video_sendrecv ("x265enc", h265_expected_caps, "H265/90000", FALSE, FALSE); + test_video_sendrecv ("x265enc", h265_expected_caps, "H265/90000", FALSE, TRUE); + test_video_sendrecv ("x265enc", h265_expected_caps, "H265/90000", TRUE, TRUE); +} +GST_END_TEST + GST_START_TEST (test_vp8_sendrecv) { test_video_sendrecv ("vp8enc", vp8_expected_caps, "VP8/90000", FALSE, FALSE); @@ -1946,6 +1982,15 @@ GST_START_TEST (test_av1_sendrecv) } GST_END_TEST +GST_START_TEST (test_h265_sendrecv_but_sendonly) +{ + test_video_sendonly ("x265enc", h265_expected_caps, "H265/90000", TRUE, FALSE, + FALSE, NULL); + test_video_sendonly ("x265enc", h265_expected_caps, "H265/90000", FALSE, FALSE, + FALSE, NULL); +} +GST_END_TEST + GST_START_TEST (test_vp8_sendrecv_but_sendonly) { test_video_sendonly ("vp8enc", vp8_expected_caps, "VP8/90000", TRUE, FALSE, @@ -1984,6 +2029,15 @@ GST_START_TEST (test_pcmu_sendrecv) GST_END_TEST /* Audio and video tests */ +GST_START_TEST (test_pcmu_h265_sendonly_recvonly) +{ + test_audio_video_sendonly_recvonly ("mulawenc", pcmu_expected_caps, + "PCMU/8000", "x265enc", h265_expected_caps, "H265/90000", FALSE); + test_audio_video_sendonly_recvonly ("mulawenc", pcmu_expected_caps, + "PCMU/8000", "x265enc", h265_expected_caps, "H265/90000", TRUE); +} +GST_END_TEST + GST_START_TEST (test_pcmu_vp8_sendonly_recvonly) { test_audio_video_sendonly_recvonly ("mulawenc", pcmu_expected_caps, @@ -2013,6 +2067,15 @@ GST_START_TEST (test_pcmu_av1_sendonly_recvonly) GST_END_TEST +GST_START_TEST (test_pcmu_h265_sendrecv) +{ + test_audio_video_sendrecv ("mulawenc", pcmu_expected_caps, "PCMU/8000", + "x265enc", h265_expected_caps, "H265/90000", FALSE); + test_audio_video_sendrecv ("mulawenc", pcmu_expected_caps, "PCMU/8000", + "x265enc", h265_expected_caps, "H265/90000", TRUE); +} +GST_END_TEST + GST_START_TEST (test_pcmu_vp8_sendrecv) { test_audio_video_sendrecv ("mulawenc", pcmu_expected_caps, "PCMU/8000", @@ -2575,6 +2638,15 @@ webrtcendpoint_test_suite (void) tcase_add_test (tc_chain, test_pcmu_av1_sendrecv); tcase_add_test (tc_chain, test_pcmu_av1_sendonly_recvonly); + tcase_add_test (tc_chain, test_h265_sendrecv_but_sendonly); + tcase_add_test (tc_chain, test_h265_sendonly_recvonly); + tcase_add_test (tc_chain, test_h265_sendonly_recvonly_rsa); + tcase_add_test (tc_chain, test_h265_sendonly_recvonly_ecdsa); + tcase_add_test (tc_chain, test_h265_sendrecv); + tcase_add_test (tc_chain, test_offerer_pcmu_h265_answerer_vp8_sendrecv); + tcase_add_test (tc_chain, test_pcmu_h265_sendrecv); + tcase_add_test (tc_chain, test_pcmu_h265_sendonly_recvonly); + tcase_add_test (tc_chain, test_remb_params); tcase_add_test (tc_chain, test_session_creation); tcase_add_test (tc_chain, test_port_range); From f767c7667e220e7207cec019178a7668abe81309 Mon Sep 17 00:00:00 2001 From: Saul Pablo Labajo Izquierdo Date: Wed, 6 Nov 2024 18:31:45 +0000 Subject: [PATCH 2/7] fix typo --- server/module-core/src/server/config/SdpEndpoint.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/module-core/src/server/config/SdpEndpoint.conf.json b/server/module-core/src/server/config/SdpEndpoint.conf.json index a0c96cf062..8e5910fcae 100644 --- a/server/module-core/src/server/config/SdpEndpoint.conf.json +++ b/server/module-core/src/server/config/SdpEndpoint.conf.json @@ -18,7 +18,7 @@ { "name": "AMR/8000" } ], "videoCodecs": [ - { "name": "H265/90000" } + { "name": "H265/90000" }, { "name": "AV1/90000" }, { "name": "VP9/90000" }, { "name": "VP8/90000" }, From f3de8e443dbea0cf61493b83efc92559f4bef0de Mon Sep 17 00:00:00 2001 From: Saul Pablo Labajo Izquierdo Date: Wed, 6 Nov 2024 22:14:13 +0000 Subject: [PATCH 3/7] fix min bitrate for x265 --- .../module-core/src/gst-plugins/commons/kmsenctreebin.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/module-core/src/gst-plugins/commons/kmsenctreebin.c b/server/module-core/src/gst-plugins/commons/kmsenctreebin.c index ff1e9bc306..400dc4bbb8 100644 --- a/server/module-core/src/gst-plugins/commons/kmsenctreebin.c +++ b/server/module-core/src/gst-plugins/commons/kmsenctreebin.c @@ -342,6 +342,8 @@ kms_enc_tree_bin_set_target_bitrate (KmsEncTreeBin *self) gint new_bitrate = kms_enc_tree_bin_get_bitrate (self); gint kbps_div; + guint min_bitrate = 0; + guint br; if (new_bitrate <= 0) { return; @@ -352,6 +354,7 @@ kms_enc_tree_bin_set_target_bitrate (KmsEncTreeBin *self) property_name = h265_property_name; kbps_div = 1; new_bitrate /= 1000; + min_bitrate = 1; break; case VP9: property_name = vpx_property_name; @@ -387,7 +390,11 @@ kms_enc_tree_bin_set_target_bitrate (KmsEncTreeBin *self) return; } - g_object_set (self->priv->enc, property_name, new_bitrate * kbps_div / 1000, NULL); + br = new_bitrate * kbps_div / 1000; + if (br < min_bitrate) { + br = min_bitrate; + } + g_object_set (self->priv->enc, property_name, br, NULL); GST_DEBUG_OBJECT (self->priv->enc, "\"%s\" set: %d", property_name, new_bitrate); From 081fdda3a00048a3fab9c4836d229a8955f7ae37 Mon Sep 17 00:00:00 2001 From: Saul Pablo Labajo Izquierdo Date: Wed, 6 Nov 2024 22:14:36 +0000 Subject: [PATCH 4/7] tests for h265 --- .../tests/check/element/agnosticbin.c | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/server/module-core/tests/check/element/agnosticbin.c b/server/module-core/tests/check/element/agnosticbin.c index 4c01ec0b44..f9e26a2287 100644 --- a/server/module-core/tests/check/element/agnosticbin.c +++ b/server/module-core/tests/check/element/agnosticbin.c @@ -1344,6 +1344,45 @@ GST_START_TEST (test_raw_to_rtp_h264) GST_END_TEST; +GST_START_TEST (test_raw_to_rtp_h265) +{ + GstElement *fakesink; + GstElement *pipeline = + gst_parse_launch + ("videotestsrc is-live=true" + " ! agnosticbin ! application/x-rtp,media=(string)video," + " encoding-name=(string)H265,clock-rate=(int)90000" + " ! fakesink async=true sync=true name=sink signal-handoffs=true", + NULL); + GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + + loop = g_main_loop_new (NULL, TRUE); + + gst_bus_add_signal_watch (bus); + g_signal_connect (bus, "message", G_CALLBACK (bus_msg), pipeline); + + fakesink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); + + g_signal_connect (G_OBJECT (fakesink), "handoff", + G_CALLBACK (fakesink_hand_off), loop); + + g_object_unref (fakesink); + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + mark_point (); + g_main_loop_run (loop); + mark_point (); + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_bus_remove_signal_watch (bus); + g_object_unref (bus); + g_object_unref (pipeline); + g_main_loop_unref (loop); +} + +GST_END_TEST; + GST_START_TEST (test_raw_to_rtp_av1) { GstElement *fakesink; @@ -1707,6 +1746,22 @@ GST_START_TEST (test_codec_config_av1) GST_END_TEST; +GST_START_TEST (test_codec_config_x265) +{ + const gchar *pipeline_str = + "videotestsrc is-live=true" + " ! agnosticbin name=ag ! capsfilter caps=video/x-h265" + " ! fakesink async=true sync=true name=sink signal-handoffs=true"; + const gchar *config_str = + "x265,speed-preset=faster,tune=zerolatency"; + const gchar *codec_name = "x264"; + const gchar *agnostic_name = "ag"; + + test_codec_config (pipeline_str, config_str, codec_name, agnostic_name); +} + +GST_END_TEST; + GST_START_TEST (test_codec_config_vp8) { const gchar *pipeline_str = @@ -1788,10 +1843,12 @@ agnostic2_suite (void) tcase_add_test (tc_chain, test_codec_config_openh264); tcase_add_test (tc_chain, test_codec_config_vp9); tcase_add_test (tc_chain, test_codec_config_av1); - + tcase_add_test (tc_chain, test_codec_config_x265); + tcase_add_test (tc_chain, test_raw_to_rtp); tcase_add_test (tc_chain, test_raw_to_rtp_vp9); tcase_add_test (tc_chain, test_raw_to_rtp_h264); + tcase_add_test (tc_chain, test_raw_to_rtp_h265); tcase_add_test (tc_chain, test_raw_to_rtp_av1); tcase_add_test (tc_chain, test_raw_to_rtp_opus); tcase_add_test (tc_chain, test_raw_to_rtp_pcmu); From 9501fa01f755c4ef97718432d430a266802e9a81 Mon Sep 17 00:00:00 2001 From: Saul Pablo Labajo Izquierdo Date: Wed, 6 Nov 2024 22:37:14 +0000 Subject: [PATCH 5/7] fix typo --- .../src/server/implementation/objects/WebRtcEndpointImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/module-elements/src/server/implementation/objects/WebRtcEndpointImpl.cpp b/server/module-elements/src/server/implementation/objects/WebRtcEndpointImpl.cpp index 3a146a6844..c346d5b4fd 100644 --- a/server/module-elements/src/server/implementation/objects/WebRtcEndpointImpl.cpp +++ b/server/module-elements/src/server/implementation/objects/WebRtcEndpointImpl.cpp @@ -641,7 +641,7 @@ WebRtcEndpointImpl::WebRtcEndpointImpl (const boost::property_tree::ptree &conf, std::string enableH265; - if (getConfigValue(&cfg_dscp_value, PARAM_ENABLE_H265)) { + if (getConfigValue(&enableH265, PARAM_ENABLE_H265)) { GST_INFO ("ENABLE-H265 configured value is %s", enableH265.c_str()); if (enableH265 == "true") { add_support_for_h265 (); From 80ab7f55b55ab4bc7d1fb81f200a74ee733e789e Mon Sep 17 00:00:00 2001 From: Saul Pablo Labajo Izquierdo Date: Wed, 6 Nov 2024 22:41:38 +0000 Subject: [PATCH 6/7] fix h265 tests --- .../tests/check/element/webrtcendpoint.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/server/module-elements/tests/check/element/webrtcendpoint.c b/server/module-elements/tests/check/element/webrtcendpoint.c index d3348a11a1..cfb233dcad 100644 --- a/server/module-elements/tests/check/element/webrtcendpoint.c +++ b/server/module-elements/tests/check/element/webrtcendpoint.c @@ -2114,7 +2114,19 @@ GST_START_TEST (test_offerer_pcmu_vp8_answerer_vp8_sendrecv) } GST_END_TEST -GST_START_TEST (test_offerer_pcmu_vp8_answerer_vp9_sendrecv) +GST_START_TEST (test_offerer_pcmu_h265_answerer_h265_sendrecv) +{ + test_offerer_audio_video_answerer_video_sendrecv ("mulawenc", + pcmu_expected_caps, "PCMU/8000", "x265enc", h265_expected_caps, "H265/90000", + FALSE); + test_offerer_audio_video_answerer_video_sendrecv ("mulawenc", + pcmu_expected_caps, "PCMU/8000", "x265enc", h265_expected_caps, "H265/90000", + TRUE); +} +GST_END_TEST + + +GST_START_TEST (test_offerer_pcmu_vp9_answerer_vp9_sendrecv) { test_offerer_audio_video_answerer_video_sendrecv ("mulawenc", pcmu_expected_caps, "PCMU/8000", "vp9enc", vp9_expected_caps, "VP9/90000", @@ -2626,7 +2638,7 @@ webrtcendpoint_test_suite (void) tcase_add_test (tc_chain, test_vp9_sendonly_recvonly_rsa); tcase_add_test (tc_chain, test_vp9_sendonly_recvonly_ecdsa); tcase_add_test (tc_chain, test_vp9_sendrecv); - tcase_add_test (tc_chain, test_offerer_pcmu_vp8_answerer_vp9_sendrecv); + tcase_add_test (tc_chain, test_offerer_pcmu_vp9_answerer_vp9_sendrecv); tcase_add_test (tc_chain, test_pcmu_vp9_sendrecv); tcase_add_test (tc_chain, test_pcmu_vp9_sendonly_recvonly); @@ -2643,7 +2655,7 @@ webrtcendpoint_test_suite (void) tcase_add_test (tc_chain, test_h265_sendonly_recvonly_rsa); tcase_add_test (tc_chain, test_h265_sendonly_recvonly_ecdsa); tcase_add_test (tc_chain, test_h265_sendrecv); - tcase_add_test (tc_chain, test_offerer_pcmu_h265_answerer_vp8_sendrecv); + tcase_add_test (tc_chain, test_offerer_pcmu_h265_answerer_h265_sendrecv); tcase_add_test (tc_chain, test_pcmu_h265_sendrecv); tcase_add_test (tc_chain, test_pcmu_h265_sendonly_recvonly); From 3f7e8fc93068dc63cf52f87f50e7912f8390fba0 Mon Sep 17 00:00:00 2001 From: Saul Pablo Labajo Izquierdo Date: Thu, 7 Nov 2024 11:18:10 +0100 Subject: [PATCH 7/7] Fix x265 test --- server/module-elements/tests/check/element/webrtcendpoint.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/module-elements/tests/check/element/webrtcendpoint.c b/server/module-elements/tests/check/element/webrtcendpoint.c index cfb233dcad..15dbb8f13f 100644 --- a/server/module-elements/tests/check/element/webrtcendpoint.c +++ b/server/module-elements/tests/check/element/webrtcendpoint.c @@ -443,6 +443,8 @@ test_video_sendonly (const gchar * video_enc_name, GstStaticCaps expected_caps, // FIXME: There seems to be an error requesting keyframes to AV1 encoder, // So for the moment, the encoder will generate kayframes periodically g_object_set (video_enc, "keyframe-max-dist", 10, NULL); + } else if (g_str_equal (video_enc_name, "x265enc")) { + g_object_set (video_enc, "key-int-max", 10000, NULL); } else { g_object_set (video_enc, "keyframe-max-dist", 10000, NULL); }