2 Commits

9 changed files with 50 additions and 327 deletions

View File

@@ -1,226 +0,0 @@
From 37eeeb1a750bf2dd6d5769d759069e95dd1b8493 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete@collabora.com>
Date: Thu, 14 Nov 2024 11:16:14 -0500
Subject: [PATCH] test-new-trickle: Remove cancellable as a wakeup mechanism
Just wake up the main context directly instead. This was causing a regression
with GLib 2.83
Fixes #198
---
tests/test-new-trickle.c | 36 +++---------------------------------
1 file changed, 3 insertions(+), 33 deletions(-)
diff --git a/tests/test-new-trickle.c b/tests/test-new-trickle.c
index da808dae..e80048e5 100644
--- a/tests/test-new-trickle.c
+++ b/tests/test-new-trickle.c
@@ -67,7 +67,6 @@ static GCond *stun_thread_signal_ptr = &stun_thread_signal;
static NiceComponentState global_lagent_state = NICE_COMPONENT_STATE_LAST;
static NiceComponentState global_ragent_state = NICE_COMPONENT_STATE_LAST;
-static GCancellable *global_cancellable;
static gboolean exit_stun_thread = FALSE;
static gboolean lagent_candidate_gathering_done = FALSE;
static gboolean ragent_candidate_gathering_done = FALSE;
@@ -225,7 +224,7 @@ recv_packet:
buf_len = stun_agent_finish_message (agent, &response, NULL, 0);
send_buf:
- g_cancellable_cancel (global_cancellable);
+ g_main_context_wakeup (NULL);
g_debug ("Ready to send a STUN response");
g_assert_true (g_mutex_trylock (stun_mutex_ptr));
got_stun_packet = TRUE;
@@ -292,7 +291,6 @@ static void cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, gpoin
g_debug ("ragent finished gathering candidates");
ragent_candidate_gathering_done = TRUE;
}
- g_cancellable_cancel (global_cancellable);
}
static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id, guint len, gchar *buf, gpointer user_data)
@@ -309,7 +307,7 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
g_debug ("test-tricklemode:%s: ragent recieved %d bytes : quit mainloop",
G_STRFUNC, len);
data_received = TRUE;
- g_cancellable_cancel (global_cancellable);
+ g_main_context_wakeup (NULL);
}
}
@@ -333,7 +331,7 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint
send_stun = TRUE;
g_cond_signal (stun_signal_ptr);
g_mutex_unlock (stun_mutex_ptr);
- g_cancellable_cancel (global_cancellable);
+ g_main_context_wakeup (NULL);
}
if(GPOINTER_TO_UINT(data) == 1 && state == NICE_COMPONENT_STATE_READY) {
@@ -492,7 +490,6 @@ static void standard_test(NiceAgent *lagent, NiceAgent *ragent)
nice_agent_gather_candidates (ragent, global_rs_id);
while (!ragent_candidate_gathering_done)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (ragent_candidate_gathering_done);
g_assert_true (nice_agent_peer_candidate_gathering_done (lagent, global_ls_id));
@@ -503,7 +500,6 @@ static void standard_test(NiceAgent *lagent, NiceAgent *ragent)
while (!data_received)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (global_lagent_state >= NICE_COMPONENT_STATE_CONNECTED &&
data_received);
@@ -513,14 +509,12 @@ static void standard_test(NiceAgent *lagent, NiceAgent *ragent)
while (!lagent_candidate_gathering_done)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (lagent_candidate_gathering_done);
g_assert_true (nice_agent_peer_candidate_gathering_done (ragent, global_rs_id));
while (global_ragent_state < NICE_COMPONENT_STATE_CONNECTED)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_cmpint (global_lagent_state, ==, NICE_COMPONENT_STATE_READY);
g_assert_cmpint (global_ragent_state, >=, NICE_COMPONENT_STATE_CONNECTED);
@@ -542,14 +536,12 @@ static void bad_credentials_test(NiceAgent *lagent, NiceAgent *ragent)
nice_agent_gather_candidates (lagent, global_ls_id);
while (!got_stun_packet)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (global_lagent_state == NICE_COMPONENT_STATE_GATHERING &&
!lagent_candidate_gathering_done);
nice_agent_gather_candidates (ragent, global_rs_id);
while (!ragent_candidate_gathering_done)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (ragent_candidate_gathering_done);
g_assert_true (nice_agent_peer_candidate_gathering_done (lagent, global_ls_id));
@@ -558,7 +550,6 @@ static void bad_credentials_test(NiceAgent *lagent, NiceAgent *ragent)
while (global_lagent_state != NICE_COMPONENT_STATE_FAILED)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
// Set the correct credentials and swap candidates
g_debug ("Setting local candidates of ragent as remote candidates of lagent");
@@ -571,7 +562,6 @@ static void bad_credentials_test(NiceAgent *lagent, NiceAgent *ragent)
while (!data_received)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (data_received);
g_assert_cmpint (global_lagent_state, ==, NICE_COMPONENT_STATE_READY);
@@ -580,7 +570,6 @@ static void bad_credentials_test(NiceAgent *lagent, NiceAgent *ragent)
// Wait for lagent to finish gathering candidates
while (!lagent_candidate_gathering_done)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (lagent_candidate_gathering_done);
g_assert_true (nice_agent_peer_candidate_gathering_done (ragent, global_rs_id));
@@ -599,14 +588,12 @@ static void bad_candidate_test(NiceAgent *lagent,NiceAgent *ragent)
nice_agent_gather_candidates (lagent, global_ls_id);
while (!got_stun_packet)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (global_lagent_state == NICE_COMPONENT_STATE_GATHERING &&
!lagent_candidate_gathering_done);
nice_agent_gather_candidates (ragent, global_rs_id);
while (!ragent_candidate_gathering_done)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (ragent_candidate_gathering_done);
g_assert_true (nice_agent_peer_candidate_gathering_done (lagent, global_ls_id));
@@ -616,14 +603,12 @@ static void bad_candidate_test(NiceAgent *lagent,NiceAgent *ragent)
// lagent will finish candidate gathering causing this mainloop to quit
while (!lagent_candidate_gathering_done)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (nice_agent_peer_candidate_gathering_done (ragent, global_rs_id));
// connchecks will fail causing this mainloop to quit
while (global_lagent_state != NICE_COMPONENT_STATE_FAILED)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (global_lagent_state == NICE_COMPONENT_STATE_FAILED &&
!data_received);
@@ -638,7 +623,6 @@ static void bad_candidate_test(NiceAgent *lagent,NiceAgent *ragent)
while (!data_received)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (lagent_candidate_gathering_done);
@@ -659,20 +643,17 @@ static void new_candidate_test(NiceAgent *lagent, NiceAgent *ragent)
nice_agent_gather_candidates (lagent, global_ls_id);
while (!got_stun_packet)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (global_lagent_state == NICE_COMPONENT_STATE_GATHERING &&
!lagent_candidate_gathering_done);
nice_agent_gather_candidates (ragent, global_rs_id);
while (!ragent_candidate_gathering_done)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (nice_agent_peer_candidate_gathering_done (lagent, global_ls_id));
// Wait for data
while (!data_received)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (data_received);
// Data arrived, signal STUN thread to send STUN response
@@ -684,7 +665,6 @@ static void new_candidate_test(NiceAgent *lagent, NiceAgent *ragent)
// Wait for lagent to finish gathering candidates
while (!lagent_candidate_gathering_done)
g_main_context_iteration (NULL, TRUE);
- g_cancellable_reset (global_cancellable);
g_assert_true (nice_agent_peer_candidate_gathering_done (ragent, global_rs_id));
g_assert_true (lagent_candidate_gathering_done);
@@ -719,14 +699,8 @@ int main(void)
NiceAgent *lagent = NULL, *ragent = NULL;
GThread *stun_thread = NULL;
NiceAddress baseaddr;
- GSource *src;
int sock;
- global_cancellable = g_cancellable_new ();
- src = g_cancellable_source_new (global_cancellable);
- g_source_set_dummy_callback (src);
- g_source_attach (src, NULL);
-
sock = listen_socket (&stun_port);
if (sock == -1) {
@@ -795,10 +769,6 @@ int main(void)
g_object_unref (ragent);
g_thread_join (stun_thread);
- g_object_unref (global_cancellable);
-
- g_source_destroy (src);
- g_source_unref (src);
WAIT_UNTIL_UNSET (lagent, NULL);
WAIT_UNTIL_UNSET (ragent, NULL);
--
GitLab

19
_service Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<services>
<service name="obs_scm" mode="manual">
<param name="scm">git</param>
<param name="url">https://gitlab.freedesktop.org/libnice/libnice.git</param>
<param name="revision">ac4bb22ebbfce712729aec277259c5ea9254189a</param>
<param name="versionformat">@PARENT_TAG@+@TAG_OFFSET@</param>
<param name="versionrewrite-pattern">v?(.*)\+0</param>
<param name="versionrewrite-replacement">\1</param>
<param name="changesgenerate">enable</param>
</service>
<service name="tar" mode="buildtime"/>
<service name="recompress" mode="buildtime">
<param name="file">*.tar</param>
<param name="compression">zst</param>
</service>
<service name="set_version" mode="manual" />
</services>

4
_servicedata Normal file
View File

@@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://gitlab.freedesktop.org/libnice/libnice.git</param>
<param name="changesrevision">ac4bb22ebbfce712729aec277259c5ea9254189a</param></service></servicedata>

View File

@@ -1,91 +0,0 @@
From c47a7ea6289187857a38e0118bd8528cab9171c9 Mon Sep 17 00:00:00 2001
From: Jeffery Wilson <jeff@jeffalwilson.com>
Date: Thu, 27 Jun 2024 13:14:32 -0400
Subject: [PATCH] meson: Add glib debug, assert and check options
Adds `glib_debug`, `glib_assert`, and `glib_checks` options so that glib
can inherit their value. Furthermore, with
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1165
libnice will inherit these values from GStreamer.
---
meson.build | 22 ++++++++++++++++++++++
meson_options.txt | 9 +++++++++
tests/meson.build | 7 ++++++-
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 39d943df..51abfe0b 100644
--- a/meson.build
+++ b/meson.build
@@ -85,6 +85,28 @@ add_project_arguments('-D_GNU_SOURCE',
'-DNICE_VERSION_NANO=' + version_nano,
language: 'c')
+# Same logic as in GLib.
+glib_debug = get_option('glib_debug')
+disable_cast_checks = glib_debug.disabled() or (
+ glib_debug.auto() and (not get_option('debug') or get_option('optimization') not in [ '0', 'g' ]))
+if disable_cast_checks
+ message('Disabling GLib cast checks')
+ add_project_arguments('-DG_DISABLE_CAST_CHECKS', language: 'c')
+ disable_cast_checks = true
+endif
+
+disable_glib_asserts = not get_option('glib_assert')
+if disable_glib_asserts
+ message('Disabling GLib asserts')
+ add_project_arguments('-DG_DISABLE_ASSERT', language: 'c')
+endif
+
+disable_glib_checks = not get_option('glib_checks')
+if disable_glib_checks
+ message('Disabling GLib checks')
+ add_project_arguments('-DG_DISABLE_CHECKS', language: 'c')
+endif
+
cdata = configuration_data()
cdata.set_quoted('PACKAGE_STRING', meson.project_name())
diff --git a/meson_options.txt b/meson_options.txt
index cd980cb5..a720d742 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,6 +7,15 @@ option('ignored-network-interface-prefix', type: 'array', value: ['docker', 'vet
option('crypto-library', type: 'combo', choices : ['auto', 'gnutls', 'openssl'], value : 'auto')
# Common feature options
+option('glib_debug', type : 'feature', value : 'auto', yield : true,
+ description : 'Enable GLib debug infrastructure (see docs/macros.txt)',
+)
+option('glib_assert', type : 'boolean', value : true, yield : true,
+ description : 'Enable GLib assertion (see docs/macros.txt)',
+)
+option('glib_checks', type : 'boolean', value : true, yield : true,
+ description : 'Enable GLib checks such as API guards (see docs/macros.txt)',
+)
option('examples', type : 'feature', value : 'auto', yield : true,
description: 'Build examples')
option('tests', type : 'feature', value : 'auto', yield : true,
diff --git a/tests/meson.build b/tests/meson.build
index f1495509..c66ffbde 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -76,9 +76,14 @@ if gst_dep.found() and not static_build
gst_check = dependency('gstreamer-check-1.0', required: get_option('gstreamer'),
fallback : ['gstreamer', 'gst_check_dep'])
if gst_check.found()
+ test_defines = [
+ '-DG_LOG_DOMAIN="libnice-tests"',
+ '-UG_DISABLE_ASSERT',
+ '-UG_DISABLE_CAST_CHECKS',
+ ]
exe = executable('nice-test-gstreamer',
'test-gstreamer.c', extra_src,
- c_args: '-DG_LOG_DOMAIN="libnice-tests"',
+ c_args: test_defines,
include_directories: nice_incs,
dependencies: [nice_deps, gst_check, libm],
link_with: libnice,
--
GitLab

3
libnice-0.1.22+7.obscpio Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e498b892ec848c7ed5e8517fc822b172d7613ab057e19139d8c2110f43e159ff
size 2177548

Binary file not shown.

View File

@@ -1,3 +1,20 @@
-------------------------------------------------------------------
Thu Apr 10 08:00:15 UTC 2025 - Bjørn Lie <bjorn.lie@gmail.com>
- Update to version 0.1.22+7:
* agent: stop leaking StunResolverData
* test-new-trickle: Remove cancellable as a wakeup mechanism
* Fix TCP concurrent sending problem
* meson: Add glib debug, assert and check options
* COPYING / README: Add SPDX-License-Identifier for added clarity
* agent: Only accept remote candidates with non-zero priority
* tests: Reduce the printing a little to please libxml
* Change padding to be rfc8489 conform
- Switch to git checkout via source service.
- Drop patches fixed upstream:
* 37eeeb1a750bf2dd6d5769d759069e95dd1b8493.patch
* c47a7ea6289187857a38e0118bd8528cab9171c9.patch
-------------------------------------------------------------------
Mon Dec 9 14:55:31 UTC 2024 - Bjørn Lie <bjorn.lie@gmail.com>

4
libnice.obsinfo Normal file
View File

@@ -0,0 +1,4 @@
name: libnice
version: 0.1.22+7
mtime: 1735893010
commit: ac4bb22ebbfce712729aec277259c5ea9254189a

View File

@@ -1,7 +1,7 @@
#
# spec file for package libnice
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,20 +17,16 @@
Name: libnice
Version: 0.1.22
Version: 0.1.22+7
Release: 0
Summary: Interactive Connectivity Establishment implementation
License: LGPL-2.1-only OR MPL-1.1
Group: Development/Libraries/GNOME
URL: https://nice.freedesktop.org/
Source: %{url}/releases/%{name}-%{version}.tar.gz
Source: %{name}-%{version}.tar.zst
Source1: baselibs.conf
# PATCH-FIX-UPSTREAM libnice-port-gupnp-igd-bump.patch -- Port to new gupnp-igd
Patch1: libnice-port-gupnp-igd-bump.patch
# PATCH-FIX-UPSTREAM c47a7ea6289187857a38e0118bd8528cab9171c9.patch -- meson: Add glib debug, assert and check options
Patch2: https://gitlab.freedesktop.org/libnice/libnice/-/commit/c47a7ea6289187857a38e0118bd8528cab9171c9.patch
# PATCH-FIX-UPSTREAM 37eeeb1a750bf2dd6d5769d759069e95dd1b8493.patch -- test-new-trickle: Remove cancellable as a wakeup mechanism
Patch3: https://gitlab.freedesktop.org/libnice/libnice/-/commit/37eeeb1a750bf2dd6d5769d759069e95dd1b8493.patch
BuildRequires: meson
BuildRequires: pkgconfig