webrtc: Ensure the NICE_CHECK_VERSION macro is available
authorPhilippe Normand <philn@igalia.com>
Wed, 11 May 2022 08:15:33 +0000 (09:15 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 26 May 2022 10:54:59 +0000 (10:54 +0000)
This macro was introduced in libnice 0.1.19.1, so until we bump our libnice
dependency to 0.1.20 we have to vendor the macro.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1998>

subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c
subprojects/gst-plugins-bad/ext/webrtc/meson.build

index 5e796e1..9f2dc68 100644 (file)
 #include "icestream.h"
 #include "nicetransport.h"
 
+#ifndef NICE_CHECH_VERSION
+#define NICE_CHECK_VERSION(major, minor, micro)                                \
+  (NICE_VERSION_MAJOR > (major) ||                                             \
+   (NICE_VERSION_MAJOR == (major) && NICE_VERSION_MINOR > (minor)) ||          \
+   (NICE_VERSION_MAJOR == (major) && NICE_VERSION_MINOR == (minor) &&          \
+    NICE_VERSION_MICRO >= (micro)) ||                                          \
+   (NICE_VERSION_MAJOR == (major) && NICE_VERSION_MINOR == (minor) &&          \
+    NICE_VERSION_MICRO + 1 == (micro) && NICE_VERSION_NANO > 0))
+#endif
+
 /* XXX:
  *
  * - are locally generated remote candidates meant to be readded to libnice?
index ded8cb8..f69b4a7 100644 (file)
@@ -20,9 +20,26 @@ libnice_dep = dependency('nice', version : '>=0.1.17', required : get_option('we
                          default_options: ['tests=disabled'])
 
 if libnice_dep.found()
+  libnice_version = libnice_dep.version()
+  libnice_c_args = []
+  if libnice_version.version_compare('<0.1.20') or libnice_version.version_compare('<0.1.19.1')
+    version_arr = libnice_version.split('.')
+    libnice_version_major = version_arr[0]
+    libnice_version_minor = version_arr[1]
+    libnice_version_micro = version_arr[2]
+    if version_arr.length() == 4
+      libnice_version_nano = version_arr[3]
+    else
+      libnice_version_nano = '0'
+    endif
+    libnice_c_args = ['-DNICE_VERSION_MAJOR=' + libnice_version_major,
+                      '-DNICE_VERSION_MINOR=' + libnice_version_minor,
+                      '-DNICE_VERSION_MICRO=' + libnice_version_micro,
+                      '-DNICE_VERSION_NANO=' + libnice_version_nano ]
+  endif
   gstwebrtc_plugin = library('gstwebrtc',
     webrtc_sources,
-    c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
+    c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'] + libnice_c_args,
     include_directories : [configinc],
     dependencies : [gstbase_dep, gstsdp_dep,
                     gstapp_dep, gstwebrtc_dep, gstsctp_dep, gstrtp_dep, libnice_dep, gio_dep],