From c7c9b9b690ec04a244cbf30701f953dd28c0e1bd Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 10 Mar 2013 12:13:35 +0000 Subject: [PATCH] * Sun Mar 10 2013 Hans de Goede - 1.0.5-2 - Add a patch from upstream git to fix h264 decoding artifacts (rf#2710) - Add a patch from upstream libav to fix miscompilation with gcc-4.8 (rf#2710, gnome#695166, libav#388) --- gst-libav-fix-h264-decoding.patch | 84 +++++++++++++++++++ gstreamer1-libav.spec | 15 +++- ...segfault-in-dsputil_init-with-gcc4.8.patch | 44 ++++++++++ 3 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 gst-libav-fix-h264-decoding.patch create mode 100644 libav-dsputil-fix-segfault-in-dsputil_init-with-gcc4.8.patch diff --git a/gst-libav-fix-h264-decoding.patch b/gst-libav-fix-h264-decoding.patch new file mode 100644 index 0000000..7586974 --- /dev/null +++ b/gst-libav-fix-h264-decoding.patch @@ -0,0 +1,84 @@ +From 879052472841d584e0aad21ac220131b586c1de5 Mon Sep 17 00:00:00 2001 +From: Tim-Philipp Müller +Date: Mon, 25 Feb 2013 10:38:09 +0000 +Subject: avviddec: fix H.264 decoding errors by disabling multi-threaded decoding + +Multi-threaded decoding does not work properly with the older libav 0.8 +version included in this gst-libav series, so just disable multi-threaded +decoding again entirely for now. (We could also switch from FF_THREAD_SLICE +to FF_THREAD_FRAME, but that may have other side-effects and just disabling +it seems safest for now). + +This works properly in git master with more recent libav 0.9.x versions. + +Adventurous users may still re-enable this functionality by setting +the GST_AVVIDDEC_MAX_THREADS environment variable to 'auto' or the +max. number of threads desired. + +https://bugzilla.gnome.org/show_bug.cgi?id=694230 +--- +diff --git a/ext/libav/gstavutils.c b/ext/libav/gstavutils.c +index 8555d8d..f7a80f6 100644 +--- a/ext/libav/gstavutils.c ++++ b/ext/libav/gstavutils.c +@@ -476,6 +476,7 @@ gst_ffmpeg_auto_max_threads (void) + if (n < 1) + n = 1; + ++ GST_INFO ("threads: %d", n); + g_once_init_leave (&n_threads, n); + } + +diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c +index 669a75d..caf3e2e 100644 +--- a/ext/libav/gstavviddec.c ++++ b/ext/libav/gstavviddec.c +@@ -106,7 +106,7 @@ struct _GstFFMpegVidDecClass + #define DEFAULT_SKIPFRAME 0 + #define DEFAULT_DIRECT_RENDERING TRUE + #define DEFAULT_DEBUG_MV FALSE +-#define DEFAULT_MAX_THREADS 0 ++#define DEFAULT_MAX_THREADS 1 + + enum + { +@@ -470,14 +470,30 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder, + * supports it) */ + ffmpegdec->context->debug_mv = ffmpegdec->debug_mv; + +- if (ffmpegdec->max_threads == 0) { +- if (!(oclass->in_plugin->capabilities & CODEC_CAP_AUTO_THREADS)) +- ffmpegdec->context->thread_count = gst_ffmpeg_auto_max_threads (); +- else +- ffmpegdec->context->thread_count = 0; +- } else +- ffmpegdec->context->thread_count = ffmpegdec->max_threads; ++ { ++ const gchar *env = g_getenv ("GST_AVVIDDEC_MAX_THREADS"); ++ int max_threads = ffmpegdec->max_threads; ++ ++ if (env != NULL) { ++ if (g_str_equal (env, "auto")) ++ max_threads = 0; ++ else ++ max_threads = MAX (atoi (env), 0); ++ ++ if (max_threads != 1) { ++ GST_WARNING_OBJECT (ffmpegdec, "max threads forced to %d, this might " ++ "lead to decoding errors or artefacts", max_threads); ++ } ++ } + ++ if (max_threads == 0) { ++ if (!(oclass->in_plugin->capabilities & CODEC_CAP_AUTO_THREADS)) ++ ffmpegdec->context->thread_count = gst_ffmpeg_auto_max_threads (); ++ else ++ ffmpegdec->context->thread_count = 0; ++ } else ++ ffmpegdec->context->thread_count = max_threads; ++ } + ffmpegdec->context->thread_type = FF_THREAD_SLICE; + + /* open codec - we don't select an output pix_fmt yet, +-- +cgit v0.9.0.2-2-gbebe diff --git a/gstreamer1-libav.spec b/gstreamer1-libav.spec index 334a4ce..2bedc22 100644 --- a/gstreamer1-libav.spec +++ b/gstreamer1-libav.spec @@ -1,6 +1,6 @@ Name: gstreamer1-libav Version: 1.0.5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: GStreamer 1.0 libav-based plug-ins Group: Applications/Multimedia License: LGPLv2+ @@ -9,6 +9,8 @@ Source0: http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-%{versi # We drop in a newer libav to get all the security bugfixes from there! Source1: http://libav.org/releases/libav-0.8.5.tar.xz Patch0: gst-ffmpeg-0.10.12-ChangeLog-UTF-8.patch +Patch1: gst-libav-fix-h264-decoding.patch +Patch2: libav-dsputil-fix-segfault-in-dsputil_init-with-gcc4.8.patch BuildRequires: gstreamer1-devel >= 1.0.0 BuildRequires: gstreamer1-plugins-base-devel >= 1.0.0 BuildRequires: orc-devel bzip2-devel zlib-devel @@ -29,9 +31,13 @@ This package provides libav-based GStreamer plug-ins. %prep %setup -q -n gst-libav-%{version} -a 1 +%patch0 -p1 +%patch1 -p1 +pushd libav-0.8.5 +%patch2 -p1 +popd rm -r gst-libs/ext/libav mv libav-0.8.5 gst-libs/ext/libav -%patch0 -p1 %build @@ -56,6 +62,11 @@ rm $RPM_BUILD_ROOT%{_libdir}/gstreamer-1.0/libgst*.la %changelog +* Sun Mar 10 2013 Hans de Goede - 1.0.5-2 +- Add a patch from upstream git to fix h264 decoding artifacts (rf#2710) +- Add a patch from upstream libav to fix miscompilation with gcc-4.8 + (rf#2710, gnome#695166, libav#388) + * Sat Mar 2 2013 Hans de Goede - 1.0.5-1 - Rebase to 1.0.5 (rf#2688) - Upgrade the buildin libav to 0.8.5 to get all the security fixes from diff --git a/libav-dsputil-fix-segfault-in-dsputil_init-with-gcc4.8.patch b/libav-dsputil-fix-segfault-in-dsputil_init-with-gcc4.8.patch new file mode 100644 index 0000000..ceede06 --- /dev/null +++ b/libav-dsputil-fix-segfault-in-dsputil_init-with-gcc4.8.patch @@ -0,0 +1,44 @@ +From ae8f132ace291534ed64023029023c2338f8d3bb Mon Sep 17 00:00:00 2001 +From: Sebastian Keller +Date: Sat, 9 Mar 2013 23:57:14 +0100 +Subject: [PATCH] dsputil: fix segfault in dsputil_init with gcc 4.8 + +--- + libavcodec/dsputil.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c +index 66f1f93..621b00c 100644 +--- a/libavcodec/dsputil.c ++++ b/libavcodec/dsputil.c +@@ -2788,7 +2788,7 @@ int ff_check_alignment(void){ + + av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) + { +- int i; ++ int i, j; + + ff_check_alignment(); + +@@ -3154,11 +3154,13 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) + if (ARCH_SH4) dsputil_init_sh4 (c, avctx); + if (ARCH_BFIN) dsputil_init_bfin (c, avctx); + +- for(i=0; i<64; i++){ +- if(!c->put_2tap_qpel_pixels_tab[0][i]) +- c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i]; +- if(!c->avg_2tap_qpel_pixels_tab[0][i]) +- c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i]; ++ for(i=0; i<4; i++){ ++ for(j=0; j<16; j++) { ++ if(!c->put_2tap_qpel_pixels_tab[i][j]) ++ c->put_2tap_qpel_pixels_tab[i][j]= c->put_h264_qpel_pixels_tab[i][j]; ++ if(!c->avg_2tap_qpel_pixels_tab[i][j]) ++ c->avg_2tap_qpel_pixels_tab[i][j]= c->avg_h264_qpel_pixels_tab[i][j]; ++ } + } + + ff_init_scantable_permutation(c->idct_permutation, +-- +1.8.1.4 +