summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTorsten Jager <t.jager@gmx.de>2014-06-12 15:31:40 +0200
committerTorsten Jager <t.jager@gmx.de>2014-06-12 15:31:40 +0200
commit7a4c5c18dc78fcbbfb44d52f84ed4ffaf6c498c3 (patch)
treead84d90e8f9c90532feec377a8c545333a7e3af3 /src
parente7064965ea221e89383533e012da64e67ddcb6f8 (diff)
downloadxine-lib-7a4c5c18dc78fcbbfb44d52f84ed4ffaf6c498c3.tar.gz
xine-lib-7a4c5c18dc78fcbbfb44d52f84ed4ffaf6c498c3.tar.bz2
ff_video_decoder: fix multithreading #4.
Avoid H.265 image size pumping on x86, for example. This really is a workaround for an ff bug. They should issue emms when done with a frame instead.
Diffstat (limited to 'src')
-rw-r--r--src/combined/ffmpeg/ff_video_decoder.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c
index 95e40abe0..19fe681a1 100644
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -59,6 +59,11 @@
#include "ffmpeg_compat.h"
+#if (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(HAVE_MMX)
+#include "xine_mmx.h"
+#define ENABLE_EMMS
+#endif
+
#define VIDEOBUFSIZE (128*1024)
#define SLICE_BUFFER_SIZE (1194*1024)
@@ -170,6 +175,11 @@ struct ff_video_decoder_s {
#define STATE_FRAME_SENT 3
#define STATE_FLUSHED 4
int state;
+
+#ifdef ENABLE_EMMS
+ /* see get_buffer () */
+ int emms;
+#endif
};
/* import color matrix names */
@@ -281,6 +291,14 @@ static int get_buffer (AVCodecContext *context, AVFrame *av_frame)
int top_edge;
int guarded_render = 0;
+#ifdef ENABLE_EMMS
+ /* some background thread may call this while still in mmx mode.
+ this will trash "double" aspect ratio values, even when only
+ passing them to vo_get_frame () verbatim. */
+ if (this->emms)
+ emms ();
+#endif
+
/* multiple threads have individual contexts !! */
#ifdef AVCODEC_HAS_COLORSPACE
if (context != this->context) {
@@ -2519,6 +2537,10 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen,
this->pix_fmt = -1;
this->rgb2yuy2 = NULL;
+#ifdef ENABLE_EMMS
+ this->emms = !!(xine_mm_accel () & (MM_ACCEL_X86_MMX | MM_ACCEL_X86_MMXEXT));
+#endif
+
#ifdef LOG
this->debug_fmt = -1;
#endif