Hello community,
here is the log from the commit of package freshplayerplugin for
openSUSE:Factory checked in at 2019-09-13 15:02:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/freshplayerplugin (Old)
and /work/SRC/openSUSE:Factory/.freshplayerplugin.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "freshplayerplugin"
Fri Sep 13 15:02:18 2019 rev:14 rq:730458 version:0.3.11
Changes:
--------
--- /work/SRC/openSUSE:Factory/freshplayerplugin/freshplayerplugin.changes
2018-08-15 10:39:27.932408845 +0200
+++
/work/SRC/openSUSE:Factory/.freshplayerplugin.new.7948/freshplayerplugin.changes
2019-09-13 15:03:52.397275168 +0200
@@ -1,0 +2,13 @@
+Thu Sep 12 17:36:16 UTC 2019 - Luigi Baldoni <[email protected]>
+
+- Update to version 0.3.11
+ * misc: build compatibility with newer FFmpeg (AV-prefixed
+ macros);
+ * misc: stop using __thread for thread-local variables;
+ * graphics: add explicit fullscreen window position
+ configuration;
+ * misc: fix tests on big-endian machines;
+ * misc: mention that v0.3.10 existed, but without a changelog
+ entry.
+
+-------------------------------------------------------------------
Old:
----
freshplayerplugin-0.3.9.tar.gz
New:
----
freshplayerplugin-0.3.11.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ freshplayerplugin.spec ++++++
--- /var/tmp/diff_new_pack.EPmkkE/_old 2019-09-13 15:03:53.065275026 +0200
+++ /var/tmp/diff_new_pack.EPmkkE/_new 2019-09-13 15:03:53.069275026 +0200
@@ -1,7 +1,7 @@
#
# spec file for package freshplayerplugin
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,13 +12,13 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_with restricted
Name: freshplayerplugin
-Version: 0.3.9
+Version: 0.3.11
Release: 0
Summary: PPAPI2NPAPI compatibility layer
License: MIT
++++++ freshplayerplugin-0.3.9.tar.gz -> freshplayerplugin-0.3.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/CMakeLists.txt
new/freshplayerplugin-0.3.11/CMakeLists.txt
--- old/freshplayerplugin-0.3.9/CMakeLists.txt 2017-12-23 15:34:01.000000000
+0100
+++ new/freshplayerplugin-0.3.11/CMakeLists.txt 2019-05-24 13:33:09.000000000
+0200
@@ -4,7 +4,7 @@
# version
set(VER_MAJOR 0)
set(VER_MINOR 3)
-set(VER_MICRO 9)
+set(VER_MICRO 11)
# setup compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fPIC -pthread")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/ChangeLog
new/freshplayerplugin-0.3.11/ChangeLog
--- old/freshplayerplugin-0.3.9/ChangeLog 2017-12-23 15:34:01.000000000
+0100
+++ new/freshplayerplugin-0.3.11/ChangeLog 2019-05-24 13:33:09.000000000
+0200
@@ -1,3 +1,12 @@
+2019-05-24 Rinat Ibragimov <[email protected]>
+
+ * release v0.3.11
+ * misc: build compatibility with newer FFmpeg (AV-prefixed macros)
+ * misc: stop using __thread for thread-local variables
+ * graphics: add explicit fullscreen window position configuration
+ * misc: fix tests on big-endian machines
+ * misc: mention that v0.3.10 existed, but without a changelog entry
+
2017-12-23 Rinat Ibragimov <[email protected]>
* release v0.3.9
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/freshplayerplugin-0.3.9/cmake/ffmpeg-compat/CMakeLists.txt
new/freshplayerplugin-0.3.11/cmake/ffmpeg-compat/CMakeLists.txt
--- old/freshplayerplugin-0.3.9/cmake/ffmpeg-compat/CMakeLists.txt
2017-12-23 15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/cmake/ffmpeg-compat/CMakeLists.txt
2019-05-24 13:33:09.000000000 +0200
@@ -29,6 +29,7 @@
MACRO_C_SOURCE_CHECK(cfg_avcodecid.c HAVE_AVCodecID)
MACRO_C_SOURCE_CHECK(cfg_avcodeccontext_get_buffer2.c
HAVE_AVCodecContext_get_buffer2)
MACRO_C_SOURCE_CHECK(cfg_AVVDPAUContext.c HAVE_AVVDPAUContext)
+MACRO_C_SOURCE_CHECK(cfg_avcodecflags.c HAVE_AV_CODEC_FLAGS)
MACRO_SYMBOL_CHECK(av_frame_alloc "libavcodec/avcodec.h" HAVE_av_frame_alloc)
MACRO_SYMBOL_CHECK(av_frame_free "libavcodec/avcodec.h" HAVE_av_frame_free)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/freshplayerplugin-0.3.9/cmake/ffmpeg-compat/cfg_avcodecflags.c
new/freshplayerplugin-0.3.11/cmake/ffmpeg-compat/cfg_avcodecflags.c
--- old/freshplayerplugin-0.3.9/cmake/ffmpeg-compat/cfg_avcodecflags.c
1970-01-01 01:00:00.000000000 +0100
+++ new/freshplayerplugin-0.3.11/cmake/ffmpeg-compat/cfg_avcodecflags.c
2019-05-24 13:33:09.000000000 +0200
@@ -0,0 +1,4 @@
+#include <libavcodec/avcodec.h>
+int main(void) {
+ return AV_CODEC_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/freshplayerplugin-0.3.9/cmake/ffmpeg-compat/ffmpeg_compat.h.in
new/freshplayerplugin-0.3.11/cmake/ffmpeg-compat/ffmpeg_compat.h.in
--- old/freshplayerplugin-0.3.9/cmake/ffmpeg-compat/ffmpeg_compat.h.in
2017-12-23 15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/cmake/ffmpeg-compat/ffmpeg_compat.h.in
2019-05-24 13:33:09.000000000 +0200
@@ -6,3 +6,4 @@
#define HAVE_av_frame_free (@HAVE_av_frame_free@)
#define HAVE_avcodec_free_context (@HAVE_avcodec_free_context@)
#define HAVE_AVVDPAUContext (@HAVE_AVVDPAUContext@)
+#define HAVE_AV_CODEC_FLAGS (@HAVE_AV_CODEC_FLAGS@)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/freshplayerplugin-0.3.9/data/freshwrapper.conf.example
new/freshplayerplugin-0.3.11/data/freshwrapper.conf.example
--- old/freshplayerplugin-0.3.9/data/freshwrapper.conf.example 2017-12-23
15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/data/freshwrapper.conf.example 2019-05-24
13:33:09.000000000 +0200
@@ -65,6 +65,10 @@
fullscreen_horz_maximize_atom = 1
fullscreen_vert_maximize_atom = 1
+# When set, forces full screen window to have exact position and size.
+# Separated by commas: left, top, width, height.
+# fullscreen_window_geometry = "0,0,1920,1080"
+
# Enables DNS query case randomization to partially protect against DNS
# poisoning attacks. It was reported that some Mikrotik routers do not
# support this trick. Set parameter to 0 if you have an affected model
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/CMakeLists.txt
new/freshplayerplugin-0.3.11/src/CMakeLists.txt
--- old/freshplayerplugin-0.3.9/src/CMakeLists.txt 2017-12-23
15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/src/CMakeLists.txt 2019-05-24
13:33:09.000000000 +0200
@@ -28,6 +28,7 @@
main_thread.c
reverse_constant.c
tables.c
+ thread_local.c
trace_helpers.c
trace_core.c
n2p_proxy_class.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/config.c
new/freshplayerplugin-0.3.11/src/config.c
--- old/freshplayerplugin-0.3.9/src/config.c 2017-12-23 15:34:01.000000000
+0100
+++ new/freshplayerplugin-0.3.11/src/config.c 2019-05-24 13:33:09.000000000
+0200
@@ -48,6 +48,7 @@
.fullscreen_height = 0,
.fullscreen_horz_maximize_atom = 1,
.fullscreen_vert_maximize_atom = 1,
+ .fullscreen_window_geometry = NULL,
.randomize_dns_case = 0,
.device_scale = 1.0,
.enable_windowed_mode = 1,
@@ -90,6 +91,7 @@
CFG_SIMPLE_INT("fullscreen_height", &config.fullscreen_height),
CFG_SIMPLE_INT("fullscreen_horz_maximize_atom",
&config.fullscreen_horz_maximize_atom),
CFG_SIMPLE_INT("fullscreen_vert_maximize_atom",
&config.fullscreen_vert_maximize_atom),
+ CFG_SIMPLE_STR("fullscreen_window_geometry",
&config.fullscreen_window_geometry),
CFG_SIMPLE_INT("randomize_dns_case", &config.randomize_dns_case),
CFG_SIMPLE_FLOAT("device_scale", &config.device_scale),
CFG_SIMPLE_INT("enable_windowed_mode", &config.enable_windowed_mode),
@@ -239,6 +241,7 @@
FREE_IF_CHANGED(pepperflash_path);
FREE_IF_CHANGED(flash_command_line);
FREE_IF_CHANGED(jack_server_name);
+ FREE_IF_CHANGED(fullscreen_window_geometry);
g_free(pepper_data_dir);
g_free(pepper_salt_file_name);
initialized = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/config.h
new/freshplayerplugin-0.3.11/src/config.h
--- old/freshplayerplugin-0.3.9/src/config.h 2017-12-23 15:34:01.000000000
+0100
+++ new/freshplayerplugin-0.3.11/src/config.h 2019-05-24 13:33:09.000000000
+0200
@@ -40,6 +40,7 @@
int fullscreen_height;
int fullscreen_horz_maximize_atom;
int fullscreen_vert_maximize_atom;
+ char *fullscreen_window_geometry;
int randomize_dns_case;
double device_scale;
int enable_windowed_mode;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/ppb_flash_fullscreen.c
new/freshplayerplugin-0.3.11/src/ppb_flash_fullscreen.c
--- old/freshplayerplugin-0.3.9/src/ppb_flash_fullscreen.c 2017-12-23
15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/src/ppb_flash_fullscreen.c 2019-05-24
13:33:09.000000000 +0200
@@ -223,6 +223,31 @@
ev->xgraphicsexpose.height = pp_i->fs_height;
}
+static int
+get_window_geometry_from_string(const char *str, struct PP_Rect *out)
+{
+ struct PP_Rect res = {};
+
+ gchar **parts = g_strsplit(str, ",", -1);
+ unsigned int n = 0;
+ for (gchar **ptr = parts; *ptr != NULL; ptr++)
+ n += 1;
+
+ if (n < 4) {
+ g_strfreev(parts);
+ return -1;
+ }
+
+ res.point.x = MIN(G_MAXINT32, g_ascii_strtoull(parts[0], NULL, 10));
+ res.point.y = MIN(G_MAXINT32, g_ascii_strtoull(parts[1], NULL, 10));
+ res.size.width = MIN(G_MAXINT32, g_ascii_strtoull(parts[2], NULL, 10));
+ res.size.height = MIN(G_MAXINT32, g_ascii_strtoull(parts[3], NULL, 10));
+
+ g_strfreev(parts);
+ *out = res;
+ return 0;
+}
+
static
void
fullscreen_window_thread_int(Display *dpy, struct thread_param_s *tp)
@@ -240,15 +265,26 @@
// get current mouse pointer position
XQueryPointer(dpy, DefaultRootWindow(dpy), &root, &child, &px, &py,
&rel_x, &rel_y, &mask);
- // create tiny window where mouse pointer is
+ // Create a window for the fullscreen content. By default, it's a small
window just under
+ // mouse cursor. That hint a window manager on which monitor to expand the
window.
+ struct PP_Rect fs_wnd_rect = {
+ .point = {.x = px - wnd_size / 2, .y = py - wnd_size / 2},
+ .size = {.width = wnd_size, .height = wnd_size},
+ };
+
+ if (config.fullscreen_window_geometry != NULL)
+ get_window_geometry_from_string(config.fullscreen_window_geometry,
&fs_wnd_rect);
+
XSetWindowAttributes attrs = {
.background_pixel = 0x000000,
.backing_store = Always,
};
- pp_i->fs_wnd = XCreateWindow(dpy, DefaultRootWindow(dpy),
- px - wnd_size / 2, py - wnd_size / 2,
wnd_size, wnd_size,
- 0, DefaultDepth(dpy, screen), InputOutput,
- DefaultVisual(dpy, screen), CWBackPixel |
CWBackingStore, &attrs);
+
+ pp_i->fs_wnd = XCreateWindow(
+ dpy, DefaultRootWindow(dpy), fs_wnd_rect.point.x, fs_wnd_rect.point.y,
+ fs_wnd_rect.size.width, fs_wnd_rect.size.height, 0,
+ DefaultDepth(dpy, screen), InputOutput, DefaultVisual(dpy, screen),
+ CWBackPixel | CWBackingStore, &attrs);
XSelectInput(dpy, pp_i->fs_wnd, KeyPressMask | KeyReleaseMask |
ButtonPressMask |
ButtonReleaseMask | PointerMotionMask |
ExposureMask |
@@ -257,8 +293,8 @@
// tell window manager we want exact position
XSizeHints size_hints = {
.flags = USPosition,
- .x = px - wnd_size / 2,
- .y = py - wnd_size / 2,
+ .x = fs_wnd_rect.point.x,
+ .y = fs_wnd_rect.point.y,
};
XSetWMNormalHints(dpy, pp_i->fs_wnd, &size_hints);
@@ -338,8 +374,8 @@
pthread_mutex_lock(&display.lock);
pp_i->is_fullscreen = 1;
- pp_i->fs_width_current = wnd_size;
- pp_i->fs_height_current = wnd_size;
+ pp_i->fs_width_current = fs_wnd_rect.size.width;
+ pp_i->fs_height_current = fs_wnd_rect.size.height;
pthread_mutex_unlock(&display.lock);
int called_did_change_view = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/ppb_message_loop.c
new/freshplayerplugin-0.3.11/src/ppb_message_loop.c
--- old/freshplayerplugin-0.3.9/src/ppb_message_loop.c 2017-12-23
15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/src/ppb_message_loop.c 2019-05-24
13:33:09.000000000 +0200
@@ -28,6 +28,7 @@
#include "ppb_message_loop.h"
#include "static_assert.h"
#include "tables.h"
+#include "thread_local.h"
#include "trace_core.h"
#include <glib.h>
#include <inttypes.h>
@@ -47,11 +48,8 @@
STATIC_ASSERT(sizeof(struct pp_message_loop_s) <= LARGEST_RESOURCE_SIZE);
-static __thread PP_Resource this_thread_message_loop = 0;
-static __thread int thread_is_not_suitable_for_message_loop = 0;
-static PP_Resource main_thread_message_loop = 0;
-static PP_Resource browser_thread_message_loop = 0;
-
+static PP_Resource main_thread_message_loop = 0;
+static PP_Resource browser_thread_message_loop = 0;
struct message_loop_task_s {
struct timespec when;
@@ -131,12 +129,12 @@
int32_t
ppb_message_loop_proclaim_this_thread_main(void)
{
- if (this_thread_message_loop == 0) {
+ if (get_thread_local()->this_thread_message_loop == 0) {
trace_error("%s, no message loop attached\n", __func__);
return PP_ERROR_WRONG_THREAD;
}
- main_thread_message_loop = this_thread_message_loop;
+ main_thread_message_loop = get_thread_local()->this_thread_message_loop;
return PP_OK;
}
@@ -149,19 +147,19 @@
int32_t
ppb_message_loop_proclaim_this_thread_browser(void)
{
- if (this_thread_message_loop == 0) {
+ if (get_thread_local()->this_thread_message_loop == 0) {
trace_error("%s, no message loop attached\n", __func__);
return PP_ERROR_WRONG_THREAD;
}
- browser_thread_message_loop = this_thread_message_loop;
+ browser_thread_message_loop = get_thread_local()->this_thread_message_loop;
return PP_OK;
}
PP_Resource
ppb_message_loop_get_current(void)
{
- return this_thread_message_loop;
+ return get_thread_local()->this_thread_message_loop;
}
int
@@ -181,7 +179,7 @@
void
ppb_message_loop_mark_thread_unsuitable(void)
{
- thread_is_not_suitable_for_message_loop = 1;
+ get_thread_local()->thread_is_not_suitable_for_message_loop = 1;
}
int32_t
@@ -192,17 +190,17 @@
return PP_ERROR_BADRESOURCE;
}
- if (thread_is_not_suitable_for_message_loop) {
+ if (get_thread_local()->thread_is_not_suitable_for_message_loop) {
trace_error("%s, can't attach to this thread\n", __func__);
return PP_ERROR_WRONG_THREAD;
}
- if (this_thread_message_loop != 0) {
+ if (get_thread_local()->this_thread_message_loop != 0) {
trace_error("%s, thread already have message loop attached\n",
__func__);
return PP_ERROR_INPROGRESS;
}
- this_thread_message_loop = message_loop;
+ get_thread_local()->this_thread_message_loop = message_loop;
return PP_OK;
}
@@ -263,7 +261,7 @@
int32_t
ppb_message_loop_run_int(PP_Resource message_loop, uint32_t flags)
{
- if (this_thread_message_loop != message_loop) {
+ if (get_thread_local()->this_thread_message_loop != message_loop) {
trace_error("%s, not attached to current thread\n", __func__);
return PP_ERROR_WRONG_THREAD;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/ppb_video_capture.c
new/freshplayerplugin-0.3.11/src/ppb_video_capture.c
--- old/freshplayerplugin-0.3.9/src/ppb_video_capture.c 2017-12-23
15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/src/ppb_video_capture.c 2019-05-24
13:33:09.000000000 +0200
@@ -46,6 +46,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/ioctl.h>
#include <unistd.h>
#if HAVE_LIBV4L2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/ppb_video_decoder.c
new/freshplayerplugin-0.3.11/src/ppb_video_decoder.c
--- old/freshplayerplugin-0.3.9/src/ppb_video_decoder.c 2017-12-23
15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/src/ppb_video_decoder.c 2019-05-24
13:33:09.000000000 +0200
@@ -70,6 +70,11 @@
#define AV_CODEC_ID_H264 CODEC_ID_H264
#endif // !HAVE_AVCodecID
+#if !HAVE_AV_CODEC_FLAGS
+#define AV_CODEC_CAP_TRUNCATED CODEC_CAP_TRUNCATED
+#define AV_CODEC_FLAG_TRUNCATED CODEC_FLAG_TRUNCATED
+#endif // !HAVE_AV_CODEC_FLAGS
+
enum hwdec_api_e {
HWDEC_NONE = 0,
HWDEC_VAAPI,
@@ -620,9 +625,9 @@
goto err;
}
- if (vd->avcodec->capabilities & CODEC_CAP_TRUNCATED) {
- trace_info("%s, codec have CODEC_CAP_TRUNCATED\n", __func__);
- vd->avctx->flags |= CODEC_FLAG_TRUNCATED;
+ if (vd->avcodec->capabilities & AV_CODEC_CAP_TRUNCATED) {
+ trace_info("%s, codec have AV_CODEC_CAP_TRUNCATED\n", __func__);
+ vd->avctx->flags |= AV_CODEC_FLAG_TRUNCATED;
}
vd->avctx->opaque = vd;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/thread_local.c
new/freshplayerplugin-0.3.11/src/thread_local.c
--- old/freshplayerplugin-0.3.9/src/thread_local.c 1970-01-01
01:00:00.000000000 +0100
+++ new/freshplayerplugin-0.3.11/src/thread_local.c 2019-05-24
13:33:09.000000000 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2018 Rinat Ibragimov
+ *
+ * This file is part of FreshPlayerPlugin.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE
+ * SOFTWARE.
+ */
+
+#include "thread_local.h"
+#include <glib.h>
+#include <stdlib.h>
+
+static GPrivate priv = G_PRIVATE_INIT(g_free);
+
+struct thread_local_block *
+get_thread_local(void)
+{
+ struct thread_local_block *data = g_private_get(&priv);
+ if (data == NULL) {
+ data = g_malloc0(sizeof(*data));
+ g_private_set(&priv, data);
+ }
+
+ return data;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/thread_local.h
new/freshplayerplugin-0.3.11/src/thread_local.h
--- old/freshplayerplugin-0.3.9/src/thread_local.h 1970-01-01
01:00:00.000000000 +0100
+++ new/freshplayerplugin-0.3.11/src/thread_local.h 2019-05-24
13:33:09.000000000 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2018 Rinat Ibragimov
+ *
+ * This file is part of FreshPlayerPlugin.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE
+ * SOFTWARE.
+ */
+
+#include <ppapi/c/pp_resource.h>
+#include <time.h>
+
+struct thread_local_block {
+ PP_Resource this_thread_message_loop;
+ int thread_is_not_suitable_for_message_loop;
+ struct timespec tictoc_ts;
+};
+
+struct thread_local_block *
+get_thread_local(void);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/src/trace_core.c
new/freshplayerplugin-0.3.11/src/trace_core.c
--- old/freshplayerplugin-0.3.9/src/trace_core.c 2017-12-23
15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/src/trace_core.c 2019-05-24
13:33:09.000000000 +0200
@@ -23,6 +23,7 @@
*/
#include "config.h"
+#include "thread_local.h"
#include "trace_core.h"
#include <pthread.h>
#include <stdarg.h>
@@ -32,8 +33,6 @@
#include <unistd.h>
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-static __thread struct timespec tictoc_ts;
-
void
trace_info(const char *fmt, ...)
@@ -90,13 +89,14 @@
void
trace_duration_tic(void)
{
- clock_gettime(CLOCK_REALTIME, &tictoc_ts);
+ clock_gettime(CLOCK_REALTIME, &get_thread_local()->tictoc_ts);
}
double
trace_duration_toc(void)
{
+ struct timespec *tictoc_ts = &get_thread_local()->tictoc_ts;
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
- return (ts.tv_sec - tictoc_ts.tv_sec) + 1e-9 * (ts.tv_nsec -
tictoc_ts.tv_nsec);
+ return (ts.tv_sec - tictoc_ts->tv_sec) + 1e-9 * (ts.tv_nsec -
tictoc_ts->tv_nsec);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/freshplayerplugin-0.3.9/tests/test_ppb_char_set.c
new/freshplayerplugin-0.3.11/tests/test_ppb_char_set.c
--- old/freshplayerplugin-0.3.9/tests/test_ppb_char_set.c 2017-12-23
15:34:01.000000000 +0100
+++ new/freshplayerplugin-0.3.11/tests/test_ppb_char_set.c 2019-05-24
13:33:09.000000000 +0200
@@ -43,8 +43,8 @@
TEST(ppb_char_set, to_utf16_all_ASCII)
{
const char *in = "Hello, world!";
- const uint8_t out[] = {'H', 0, 'e', 0, 'l', 0, 'l', 0, 'o', 0, ',', 0, '
', 0, 'w', 0,
- 'o', 0, 'r', 0, 'l', 0, 'd', 0, '!', 0};
+ const uint16_t out[] = {'H', 'e', 'l', 'l', 'o', ',', ' ',
+ 'w', 'o', 'r', 'l', 'd', '!'};
uint32_t res_len = 7777;
uint16_t *res = ppb_char_set_char_set_to_utf16(0, in, strlen(in), "UTF-8",
PP_CHARSET_CONVERSIONERROR_FAIL, &res_len);
@@ -56,9 +56,8 @@
TEST(ppb_char_set, to_utf16_basic_UTF_8)
{
const char *in = "Привет, мир!";
- const uint8_t out[] = {0x1f, 0x04, 0x40, 0x04, 0x38, 0x04, 0x32, 0x04,
0x35, 0x04,
- 0x42, 0x04, 0x2c, 0x00, 0x20, 0x00, 0x3c, 0x04,
0x38, 0x04,
- 0x40, 0x04, 0x21, 0x00};
+ const uint16_t out[] = {0x41f, 0x440, 0x438, 0x432, 0x435, 0x442,
+ 0x2c, 0x20, 0x43c, 0x438, 0x440, 0x21};
uint32_t res_len = 7777;
uint16_t *res = ppb_char_set_char_set_to_utf16(0, in, strlen(in), "UTF-8",
PP_CHARSET_CONVERSIONERROR_FAIL, &res_len);
@@ -83,8 +82,7 @@
TEST(ppb_char_set, from_utf16_all_ASCII)
{
- const uint8_t in[] = {'H', 0, 'e', 0, 'l', 0, 'l', 0, 'o', 0, ',', 0, ' ',
0, 'w', 0,
- 'o', 0, 'r', 0, 'l', 0, 'd', 0, '!', 0};
+ const uint16_t in[] = {'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r',
'l', 'd', '!'};
const char *out = "Hello, world!";
uint32_t res_len = 7777;
char *res = ppb_char_set_utf16_to_char_set(0, (const uint16_t *)in,
@@ -97,9 +95,8 @@
TEST(ppb_char_set, to_utf16_non_ASCII_all_correct)
{
- const uint8_t in[] = {0x1f, 0x04, 0x40, 0x04, 0x38, 0x04, 0x32, 0x04,
0x35, 0x04,
- 0x42, 0x04, 0x2c, 0x00, 0x20, 0x00, 0x3c, 0x04,
0x38, 0x04,
- 0x40, 0x04, 0x21, 0x00}; // "Привет, мир!"
+ const uint16_t in[] = {0x41f, 0x440, 0x438, 0x432, 0x435, 0x442, 0x2c,
+ 0x20, 0x43c, 0x438, 0x440, 0x21}; // "Привет,
мир!"
const char *out = "\xcf\xf0\xe8\xe2\xe5\xf2\x2c\x20\xec\xe8\xf0\x21"; //
"Привет, мир!"
uint32_t res_len = 7777;
char *res = ppb_char_set_utf16_to_char_set(0, (const uint16_t *)in,
@@ -112,9 +109,9 @@
TEST(ppb_char_set, to_utf16_non_ASCII_PP_CHARSET_CONVERSIONERROR_FAIL)
{
- const uint8_t in[] = {0x1f, 0x04, 0x40, 0x04, 0x38, 0x04, 0x32, 0x04,
0x35, 0x04,
- 0x42, 0x04, 0x2c, 0x00, 0x20, 0x00, 0x6b, 0x26,
0x3c, 0x04,
- 0x38, 0x04, 0x40, 0x04, 0x21, 0x00}; // "Привет,
♫мир!"
+ const uint16_t in[] = {0x41f, 0x440, 0x438, 0x432, 0x435, 0x442, 0x2c,
+ 0x20, 0x266b, 0x43c, 0x438, 0x440, 0x21};
+ // "♫" in "Привет, ♫мир!" cannot be represented in cp1251.
// const char *out = "\xcf\xf0\xe8\xe2\xe5\xf2\x2c\x20\xec\xe8\xf0\x21";
// "Привет, мир!"
uint32_t res_len = 7777;
char *res = ppb_char_set_utf16_to_char_set(0, (const uint16_t *)in,
@@ -127,9 +124,9 @@
TEST(ppb_char_set, to_utf16_non_ASCII_PP_CHARSET_CONVERSIONERROR_SKIP)
{
- const uint8_t in[] = {0x1f, 0x04, 0x40, 0x04, 0x38, 0x04, 0x32, 0x04,
0x35, 0x04,
- 0x42, 0x04, 0x2c, 0x00, 0x20, 0x00, 0x6b, 0x26,
0x3c, 0x04,
- 0x38, 0x04, 0x40, 0x04, 0x21, 0x00}; // "Привет,
♫мир!"
+ const uint16_t in[] = {
+ 0x41f, 0x440, 0x438, 0x432, 0x435, 0x442, 0x2c,
+ 0x20, 0x266b, 0x43c, 0x438, 0x440, 0x21}; // "Привет, ♫мир!"
const char *out = "\xcf\xf0\xe8\xe2\xe5\xf2\x2c\x20\xec\xe8\xf0\x21"; //
"Привет, мир!"
uint32_t res_len = 7777;
char *res = ppb_char_set_utf16_to_char_set(0, (const uint16_t *)in,
@@ -142,9 +139,9 @@
TEST(ppb_char_set, to_utf16_non_ASCII_PP_CHARSET_CONVERSIONERROR_SUBSTITUTE)
{
- const uint8_t in[] = {0x1f, 0x04, 0x40, 0x04, 0x38, 0x04, 0x32, 0x04,
0x35, 0x04,
- 0x42, 0x04, 0x2c, 0x00, 0x20, 0x00, 0x6b, 0x26,
0x3c, 0x04,
- 0x38, 0x04, 0x40, 0x04, 0x21, 0x00}; // "Привет,
♫мир!"
+ const uint16_t in[] = {
+ 0x41f, 0x440, 0x438, 0x432, 0x435, 0x442, 0x2c,
+ 0x20, 0x266b, 0x43c, 0x438, 0x440, 0x21}; // "Привет, ♫мир!"
const char *out =
"\xcf\xf0\xe8\xe2\xe5\xf2\x2c\x20\x3f\xec\xe8\xf0\x21";// "Привет, ?мир!"
uint32_t res_len = 7777;
char *res = ppb_char_set_utf16_to_char_set(0, (const uint16_t *)in,
@@ -164,9 +161,8 @@
0x6c, 0x64, 0x21};
// "Hello, world!" in UTF16-LE
- const uint8_t out[] = {0x48, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00,
0x6f, 0x00,
- 0x2c, 0x00, 0x20, 0x00, 0x77, 0x00, 0x6f, 0x00,
0x72, 0x00,
- 0x6c, 0x00, 0x64, 0x00, 0x21, 0x00};
+ const uint16_t out[] = {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20,
+ 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21};
uint32_t res_len = 7777;
uint16_t *res = ppb_char_set_char_set_to_utf16(0, (const char *)in,
sizeof(in), "gb2312",