LINUX.ORG.RU

Adventures in open-source world


0

1

Итак, решил я поправить старый баг в kdemultimedia, который меня давно добивал:

https://bugs.kde.org/show_bug.cgi?id=162248 (complete freeze of artsd at video playback) http://bugs.pearsoncomputing.net/show_bug.cgi?id=1905

фикс был простой, но в лоб не накладывался. https://git.trinitydesktop.org/cgit/tdemultimedia/commit/xine_artsplugin/xine...

пока ковырялся с ручным наложением патча, решил пересобрать xine-lib 1.1.21 под свой ffmpeg 2.8. Ну, так оно и собралось...

Во-первых оказалось что в новых binutils (>2.26) поломали линкинг, для старых (типа моего 4.9) gcc. https://forums.gentoo.org/viewtopic-t-1062042-highlight-xinelib.html

Не проблема, берём линкер gold и .... и натыкаемся на баг в libtools: https://github.com/frida/frida/blob/master/releng/patches/libtool-fixes.patch

Пересобрав libtool идём пересобирать xine-lib:

 cat ffmpeg_2.8.patch
--- src/combined/ffmpeg/ff_audio_decoder.c.orig 2012-01-18 23:30:08.000000000 +0400
+++ src/combined/ffmpeg/ff_audio_decoder.c      2017-12-05 07:22:36.095469666 +0300
@@ -46,6 +46,7 @@
 #include "ffmpeg_compat.h"

 #define AUDIOBUFSIZE (64 * 1024)
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio

 typedef struct {
   audio_decoder_class_t   decoder_class;
--- src/combined/ffmpeg/ff_video_decoder.c.orig 2012-06-08 17:36:36.000000000 +0400
+++ src/combined/ffmpeg/ff_video_decoder.c      2017-12-05 07:18:13.939466460 +0300
@@ -1055,7 +1055,7 @@
         this->bih.biWidth  = _X_BE_16(&this->buf[12]);
         this->bih.biHeight = _X_BE_16(&this->buf[14]);

-        this->context->sub_id = _X_BE_32(&this->buf[30]);
+    /*    this->context->sub_id = _X_BE_32(&this->buf[30]); */

         this->context->slice_offset = calloc(SLICE_OFFSET_SIZE, sizeof(int));
         this->slice_offset_size = SLICE_OFFSET_SIZE;
--- src/combined/ffmpeg/ffmpeg_decoder.h.orig   2012-01-18 23:30:08.000000000 +0400
+++ src/combined/ffmpeg/ffmpeg_decoder.h        2017-12-05 07:15:36.679464537 +0300
@@ -35,7 +35,7 @@

 typedef struct ff_codec_s {
   uint32_t          type;
-  enum CodecID      id;
+  enum AVCodecID      id;
   const char       *name;
 } ff_codec_t;


cat xcb_1.12.patch
--- configure.ac.orig   2012-06-09 20:40:10.000000000 +0400
+++ configure.ac        2017-12-05 10:40:15.659614712 +0300
@@ -911,7 +911,7 @@
 AC_ARG_WITH([xcb], AS_HELP_STRING([--without-xcb], [Doesn't build XCB video out plugins]))

 if test "x$with_xcb" != "xno"; then
-  PKG_CHECK_MODULES([XCB], [xcb-shape >= 1.0], [have_xcb="yes"], [have_xcb="no"])
+  PKG_CHECK_MODULES([XCB], [xcb xcb-shape >= 1.0], [have_xcb="yes"], [have_xcb="no"])
 fi

 AC_SUBST(XCB_CFLAGS)
--- src/video_out/Makefile.am.orig      2011-12-22 03:24:04.000000000 +0400
+++ src/video_out/Makefile.am   2017-12-05 10:42:03.315616029 +0300
@@ -117,7 +117,7 @@
 xineplug_vo_out_xcbshm_la_CFLAGS = $(VISIBILITY_FLAG) $(MLIB_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) -fno-strict-aliasing

 xineplug_vo_out_xcbxv_la_SOURCES = deinterlace.c video_out_xcbxv.c $(XCBOSD)
-xineplug_vo_out_xcbxv_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(XCBXV_LIBS) $(XCB_LIBS)
+xineplug_vo_out_xcbxv_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(XCBXV_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS)
 xineplug_vo_out_xcbxv_la_CFLAGS = $(VISIBILITY_FLAG) $(XCB_CFLAGS) $(XCBXV_CFLAGS) -fno-strict-aliasing

 xineplug_vo_out_xshm_la_SOURCES = video_out_xshm.c $(X11OSD)

потом соотв. накладываем патч на kdemultimedia.

cat ~/botva/src/kdemultimedia-3.5.10/new_threading_fix.patch
--- kdemultimedia-3.5.10/xine_artsplugin/xinePlayObject_impl.cpp.orig   2017-12-05 11:44:47.783662069 +0300
+++ kdemultimedia-3.5.10/xine_artsplugin/xinePlayObject_impl.cpp        2017-12-05 11:53:47.191668666 +0300
@@ -683,9 +683,15 @@
     XFlush( display );
 }

+// FIXME
+// Due to somewhat recent changes in XLib threading this had to be changed to a polling routine
+// Specifically XNextEvent acquires a global XLib lock, preventing any other XLib methods (including those used in the Xine library) from executing
+// Seems this is a known problem in other projects as well, with the only real option being a rewrite to use xcb natively (not sure if that is even possible here):
+// http://mail-archives.apache.org/mod_mbox/harmony-dev/200905.mbox/%3C200905181317.n4IDHtGQ002008@d06av03.portsmouth.uk.ibm.com%3E
+
 void xinePlayObject_impl::eventLoop()
 {
-    XEvent event;
+/*    XEvent event;

     do
     {
@@ -720,10 +726,50 @@
            }
            pthread_mutex_unlock( &mutex );
        }
-    }
-    while (event.type != ClientMessage ||
-          event.xclient.message_type != xcomAtomQuit ||
-          event.xclient.window != xcomWindow);
+    } */
+
+       XEvent event;
+       bool eventReceived = false;
+
+       do {
+               if (XPending( display )) {
+                       XNextEvent( display, &event );
+                       eventReceived = true;
+
+                       if (event.type == Expose && event.xexpose.count == 0 && event.xexpose.window == visual.d) {
+                               pthread_mutex_lock( &mutex );
+
+                               if (stream != 0) {
+                                       xine_port_send_gui_data( vo_port,
+                                                       XINE_GUI_SEND_EXPOSE_EVENT,
+                                                       &event );
+                               }
+                               else {
+                                       clearWindow();
+                               }
+                               pthread_mutex_unlock( &mutex );
+                       }
+                       else if (event.type == shmCompletionType) {
+                               pthread_mutex_lock( &mutex );
+
+                               if (stream != 0) {
+                                       xine_port_send_gui_data( vo_port,
+                                                       XINE_GUI_SEND_COMPLETION_EVENT,
+                                                       &event );
+                               }
+                               pthread_mutex_unlock( &mutex );
+                       }
+               }
+               else {
+                       usleep(50000);
+                       eventReceived = false;
+               }
+       }
+       while (!eventReceived ||
+               event.type != ClientMessage ||
+               event.xclient.message_type != xcomAtomQuit ||
+               event.xclient.window != xcomWindow);
+
 }

 void xineVideoPlayObject_impl::x11WindowId( long window )

А прикол в том, что если собрать xine-lib без поддержки xcb, то kaffeine вылетает с ошибкой инциализации видеодрайверов! В общем и kaffeine (0.8.8) я тоже пересобрал ....

Так что увы нельзя не согласиться с мнением из gcc багзиллы: такие мелкие подставочки на каждом шагу не способствуют .....

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248

Nix 2016-06-18 18:50:55 UTC Thirded. At the very least there should be a huge note in binutils NEWS about this. A subtle, unadvertised incompatibility of a new binutils with a not-very-old GCC is the sort of horror show that gives free software a bad name. At the very least make more noise about it.

★★★★★

Последнее исправление: Andrew-R (всего исправлений: 1)
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.