diff options
author | Matthew Waters <matthew@centricular.com> | 2018-09-18 16:54:38 +1000 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2018-10-16 16:34:35 +1100 |
commit | a368b18a70c5be2c6ae0c00a9d7e7492e091764b (patch) | |
tree | 1bbc254f522a5428f87a78079936c86498ced32b /data | |
parent | 4b0372d2e4c4e20cb3231e87aee8507c67977001 (diff) |
android/ndk-build: update for glib tls API additions
The previously used GStreamer custom custom patch to load certificate
files from the CA_CERTIFICATES environment variable is no longer
effective with glib-networking 2.58 and instead API was added to the
upcoming glib 2.60 release (backported to glib 2.58 in GStreamer's
cerbero) to set the default TLS database.
This patch makes use of the new API to set the default TLS database
and behaves similarly as the previous CA_CERTIFICATES environment
variable.
https://bugzilla.gnome.org/show_bug.cgi?id=796702
Diffstat (limited to 'data')
-rw-r--r-- | data/ndk-build/GStreamer.java | 4 | ||||
-rw-r--r-- | data/ndk-build/gstreamer_android-1.0.c.in | 22 |
2 files changed, 23 insertions, 3 deletions
diff --git a/data/ndk-build/GStreamer.java b/data/ndk-build/GStreamer.java index 62802121..f372940a 100644 --- a/data/ndk-build/GStreamer.java +++ b/data/ndk-build/GStreamer.java @@ -13,9 +13,9 @@ public class GStreamer { private static native void nativeInit(Context context) throws Exception; public static void init(Context context) throws Exception { - nativeInit(context); -@INCLUDE_FONTS@ copyFonts(context); @INCLUDE_CA_CERTIFICATES@ copyCaCertificates(context); +@INCLUDE_FONTS@ copyFonts(context); + nativeInit(context); } @INCLUDE_FONTS@ private static void copyFonts(Context context) { diff --git a/data/ndk-build/gstreamer_android-1.0.c.in b/data/ndk-build/gstreamer_android-1.0.c.in index ef91e2ee..00fd500f 100644 --- a/data/ndk-build/gstreamer_android-1.0.c.in +++ b/data/ndk-build/gstreamer_android-1.0.c.in @@ -71,7 +71,27 @@ gst_android_register_static_plugins (void) void gst_android_load_gio_modules (void) { - @G_IO_MODULES_LOAD@ + GTlsBackend *backend; + const gchar *ca_certs; + + @G_IO_MODULES_LOAD@ + + ca_certs = g_getenv ("CA_CERTIFICATES"); + + backend = g_tls_backend_get_default (); + if (backend && ca_certs) { + GTlsDatabase *db; + GError *error = NULL; + + db = g_tls_file_database_new (ca_certs, &error); + if (db) { + g_tls_backend_set_default_database (backend, db); + g_object_unref (db); + } else { + g_warning ("Failed to create a database from file: %s", + error ? error->message : "Unknown"); + } + } } static void |