[VDPAU] [PATCH] Add detection for multiple flash substrings

Jose Soltren jsoltren at nvidia.com
Tue May 12 10:15:04 PDT 2015


I think this is a nice change. I never liked having "libflashplayer.so"
hard coded in vdpau_wrapper.c.

I worry, though, that this change exposes us to churn based on Mozilla and
Opera policy decision about what they do with their handling of the Flash
plugin. However, my observation has been that these policies do not change
often. In fact the original motivation for having Flash detection was
Adobe's unwillingness to fix their bugs.

How is _flash_process_signatures initialized or terminated? This line
worries me:

 for (signature = _flash_process_signatures[0]; signature != NULL;
      signature++) {

If static char _flash_process_signatures[16][64] is uninitialized and
contains random data this loop will run off into the weeds. We also need
to assume that a user will modify their vdpau_wrapper.cfg and not have any
workarounds (unlikely, but this must work correctly). Or maybe I am wrong
here; if so please tell me how.


Using a statically sized array means VDPAU will only support the first N
entries of flash_process=. This is okay but should be documented.

Mechanical nit: I prefer "char *signature" instead of "char * signature".
If you do not do this I will do so in a follow on change.

Please send a follow on change for re-review.

Thanks,
--José

--
nvpublic

On 2015/04/29, 10:07 , "Sergey Frolov" <dunkan.aidaho at gmail.com> wrote:

>    Flash player library may be named differently than
>libflashplayer.so. Additionally some browsers have wrappers that do
>not expose library name.
>
>    With this patch user can specify additional substrings to match
>against by adding "flash_process=<process_name>" strings into
>/etc/vdpau_wrapper.cfg
>
>    Along with "libflashplayer.so" I've added two more:
>    * flash-mozilla.so is being used in Debian Multimedia packages
>    * operapluginwrapper-native is an Opera's (Presto) wrapper
>      process. It's safe to assume that 99% of time the only
>      vdpau-enabled software behind it is Adobe Flash.
>---
> src/vdpau_wrapper.c   | 15 +++++++++++++--
> src/vdpau_wrapper.cfg |  3 +++
> 2 files changed, 16 insertions(+), 2 deletions(-)
>
>diff --git a/src/vdpau_wrapper.c b/src/vdpau_wrapper.c
>index 8efbd39..63d858d 100644
>--- a/src/vdpau_wrapper.c
>+++ b/src/vdpau_wrapper.c
>@@ -239,6 +239,7 @@ static void _vdp_close_driver(void)
> static VdpGetProcAddress * _imp_get_proc_address;
> static VdpVideoSurfacePutBitsYCbCr * _imp_vid_put_bits_y_cb_cr;
> static VdpPresentationQueueSetBackgroundColor * _imp_pq_set_bg_color;
>+static char _flash_process_signatures[16][64];
> static int _running_under_flash;
> static int _enable_flash_uv_swap = 1;
> static int _disable_flash_pq_bg_color = 1;
>@@ -324,6 +325,7 @@ static void init_running_under_flash(void)
> {
>     FILE *fp;
>     char buffer[1024];
>+    char * signature;
>     int ret, i;
> 
>     fp = fopen("/proc/self/cmdline", "r");
>@@ -346,8 +348,11 @@ static void init_running_under_flash(void)
>     }
>     buffer[ret] = '\0';
> 
>-    if (strstr(buffer, "libflashplayer") != NULL) {
>-        _running_under_flash = 1;
>+    for (signature = _flash_process_signatures[0]; signature != NULL;
>signature++) {
>+        if (strstr(buffer, signature) != NULL) {
>+            _running_under_flash = 1;
>+            break;
>+        }
>     }
> }
> 
>@@ -355,12 +360,15 @@ static void init_config(void)
> {
>     FILE *fp;
>     char buffer[1024];
>+    char * signature;
> 
>     fp = fopen(VDPAU_SYSCONFDIR "/vdpau_wrapper.cfg", "r");
>     if (!fp) {
>         return;
>     }
> 
>+    signature = _flash_process_signatures[0];
>+
>     while (fgets(buffer, sizeof(buffer), fp) != NULL) {
>         char * equals = strchr(buffer, '=');
>         char * param;
>@@ -378,6 +386,9 @@ static void init_config(void)
>         else if (!strcmp(buffer, "disable_flash_pq_bg_color")) {
>             _disable_flash_pq_bg_color = atoi(param);
>         }
>+        else if (!strcmp(buffer, "flash_process")) {
>+            snprintf(signature++, 64, "%s ", param);
>+        }
>     }
> 
>     fclose(fp);
>diff --git a/src/vdpau_wrapper.cfg b/src/vdpau_wrapper.cfg
>index 21d5b8c..bd20fcd 100644
>--- a/src/vdpau_wrapper.cfg
>+++ b/src/vdpau_wrapper.cfg
>@@ -1,2 +1,5 @@
>+flash_process=libflashplayer.so
>+flash_process=flash-mozilla.so
>+flash_process=operapluginwrapper-native
> enable_flash_uv_swap=1
> disable_flash_pq_bg_color=1
>-- 
>2.1.4
>_______________________________________________
>VDPAU mailing list
>VDPAU at lists.freedesktop.org
>http://lists.freedesktop.org/mailman/listinfo/vdpau



More information about the VDPAU mailing list