summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/ffmpeg/chromium/patches/ugly/w32pthreads_xp_fixes_and_vp8_workaround.patch
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/ffmpeg/chromium/patches/ugly/w32pthreads_xp_fixes_and_vp8_workaround.patch')
-rw-r--r--chromium/third_party/ffmpeg/chromium/patches/ugly/w32pthreads_xp_fixes_and_vp8_workaround.patch111
1 files changed, 111 insertions, 0 deletions
diff --git a/chromium/third_party/ffmpeg/chromium/patches/ugly/w32pthreads_xp_fixes_and_vp8_workaround.patch b/chromium/third_party/ffmpeg/chromium/patches/ugly/w32pthreads_xp_fixes_and_vp8_workaround.patch
new file mode 100644
index 00000000000..dd61cd76277
--- /dev/null
+++ b/chromium/third_party/ffmpeg/chromium/patches/ugly/w32pthreads_xp_fixes_and_vp8_workaround.patch
@@ -0,0 +1,111 @@
+From 5be5dce7e195b884edb514795c32a31785668fd4 Mon Sep 17 00:00:00 2001
+From: Dale Curtis <dalecurtis@chromium.org>
+Date: Mon, 26 Aug 2013 16:06:29 -0700
+Subject: [PATCH] Fix w32pthreads on XP. Workaround duplicate static variables
+ in vp8.
+
+Both reported upstream via email.
+---
+ compat/w32pthreads.h | 25 +++++++++++++------------
+ libavcodec/vp8.c | 7 +++++++
+ 2 files changed, 20 insertions(+), 12 deletions(-)
+
+diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
+index 4b6924f..ba6da6a 100644
+--- a/compat/w32pthreads.h
++++ b/compat/w32pthreads.h
+@@ -130,7 +130,7 @@ typedef struct win32_cond_t {
+ static void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
+ {
+ win32_cond_t *win32_cond = NULL;
+- if (_WIN32_WINNT >= 0x0600 || cond_init) {
++ if (cond_init) {
+ cond_init(cond);
+ return;
+ }
+@@ -155,7 +155,7 @@ static void pthread_cond_destroy(pthread_cond_t *cond)
+ {
+ win32_cond_t *win32_cond = cond->ptr;
+ /* native condition variables do not destroy */
+- if (_WIN32_WINNT >= 0x0600 || cond_init)
++ if (cond_init)
+ return;
+
+ /* non native condition variables */
+@@ -172,7 +172,7 @@ static void pthread_cond_broadcast(pthread_cond_t *cond)
+ win32_cond_t *win32_cond = cond->ptr;
+ int have_waiter;
+
+- if (_WIN32_WINNT >= 0x0600 || cond_broadcast) {
++ if (cond_broadcast) {
+ cond_broadcast(cond);
+ return;
+ }
+@@ -202,7 +202,7 @@ static int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
+ {
+ win32_cond_t *win32_cond = cond->ptr;
+ int last_waiter;
+- if (_WIN32_WINNT >= 0x0600 || cond_wait) {
++ if (cond_wait) {
+ cond_wait(cond, mutex, INFINITE);
+ return 0;
+ }
+@@ -234,7 +234,7 @@ static void pthread_cond_signal(pthread_cond_t *cond)
+ {
+ win32_cond_t *win32_cond = cond->ptr;
+ int have_waiter;
+- if (_WIN32_WINNT >= 0x0600 || cond_signal) {
++ if (cond_signal) {
+ cond_signal(cond);
+ return;
+ }
+@@ -257,7 +257,8 @@ static void pthread_cond_signal(pthread_cond_t *cond)
+
+ static void w32thread_init(void)
+ {
+-#if _WIN32_WINNT < 0x0600
++ // TODO(dalecurtis): Upstream incorrectly assumes Vista+. Reported.
++// #if _WIN32_WINNT < 0x0600
+ HANDLE kernel_dll = GetModuleHandle(TEXT("kernel32.dll"));
+ /* if one is available, then they should all be available */
+ cond_init =
+@@ -268,12 +269,12 @@ static void w32thread_init(void)
+ (void*)GetProcAddress(kernel_dll, "WakeConditionVariable");
+ cond_wait =
+ (void*)GetProcAddress(kernel_dll, "SleepConditionVariableCS");
+-#else
+- cond_init = InitializeConditionVariable;
+- cond_broadcast = WakeAllConditionVariable;
+- cond_signal = WakeConditionVariable;
+- cond_wait = SleepConditionVariableCS;
+-#endif
++// #else
++// cond_init = InitializeConditionVariable;
++// cond_broadcast = WakeAllConditionVariable;
++// cond_signal = WakeConditionVariable;
++// cond_wait = SleepConditionVariableCS;
++// #endif
+
+ }
+
+diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
+index 9848802..d5ef9a2 100644
+--- a/libavcodec/vp8.c
++++ b/libavcodec/vp8.c
+@@ -2041,6 +2041,13 @@ static av_cold int vp8_decode_init(AVCodecContext *avctx)
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ avctx->internal->allocate_progress = 1;
+
++ // TODO(dalecurtis): w32pthreads.h includes static variables which result
++ // in multiple copies for each includer. Hack around our version not being
++ // initialized by calling initialize again.
++#if HAVE_W32THREADS
++ w32thread_init();
++#endif
++
+ ff_videodsp_init(&s->vdsp, 8);
+ ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);
+ ff_vp8dsp_init(&s->vp8dsp);
+--
+1.8.3
+