From 7a1aadd24415ee0af3a0a57877c499f8933b08fc Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Thu, 30 Jan 2020 14:32:12 -0800 Subject: [PATCH 1/2] FFmpeg: Bump to 4.2.2-Matrix-Alpha1 --- cmake/modules/FindFFMPEG.cmake | 16 ++++++------ .../patches/0001-ffmpeg-detect-openssl.patch | 19 +++----------- .../0002-ffmpeg-zlib-config-conflict.patch | 13 +++++++++- .../windows/patches/0003-ffmpeg-static.patch | 25 +++++++++++++++++-- tools/depends/target/Makefile | 1 + tools/depends/target/ffmpeg/FFMPEG-VERSION | 2 +- 6 files changed, 48 insertions(+), 28 deletions(-) diff --git a/cmake/modules/FindFFMPEG.cmake b/cmake/modules/FindFFMPEG.cmake index ef74671d4002..26ee23944d2a 100644 --- a/cmake/modules/FindFFMPEG.cmake +++ b/cmake/modules/FindFFMPEG.cmake @@ -33,14 +33,14 @@ # # required ffmpeg library versions -set(REQUIRED_FFMPEG_VERSION 4.0) -set(_avcodec_ver ">=58.18.100") -set(_avfilter_ver ">=7.16.100") -set(_avformat_ver ">=58.12.100") -set(_avutil_ver ">=56.14.100") -set(_swscale_ver ">=5.1.100") -set(_swresample_ver ">=3.1.100") -set(_postproc_ver ">=55.1.100") +set(REQUIRED_FFMPEG_VERSION 4.2) +set(_avcodec_ver ">=58.54.100") +set(_avfilter_ver ">=7.57.100") +set(_avformat_ver ">=58.29.100") +set(_avutil_ver ">=56.31.100") +set(_swscale_ver ">=5.5.100") +set(_swresample_ver ">=3.5.100") +set(_postproc_ver ">=55.5.100") # Allows building with external ffmpeg not found in system paths, diff --git a/tools/buildsteps/windows/patches/0001-ffmpeg-detect-openssl.patch b/tools/buildsteps/windows/patches/0001-ffmpeg-detect-openssl.patch index d5277ecc4165..aec54109d78e 100644 --- a/tools/buildsteps/windows/patches/0001-ffmpeg-detect-openssl.patch +++ b/tools/buildsteps/windows/patches/0001-ffmpeg-detect-openssl.patch @@ -1,26 +1,13 @@ -From 18de5c60ae0a987680681d5a0602009b428504fa Mon Sep 17 00:00:00 2001 -From: Gilles Khouzam -Date: Mon, 19 Jun 2017 16:33:38 -0700 -Subject: [PATCH] Add better detection for Openssl on Windows. - -Look for libeay32 and ssleay32 as another detection mechanism ---- - configure | 1 + - 1 file changed, 1 insertion(+) - diff --git a/configure b/configure -index a1818dc..1cf2a7c 100755 +index 34c2adb4a4..160884d8f9 100755 --- a/configure +++ b/configure -@@ -6147,6 +6147,8 @@ +@@ -6358,6 +6358,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || + check_lib openssl openssl/ssl.h OPENSSL_init_ssl -llibssl -llibcrypto -lws2_32 -lgdi32 -ladvapi32 -luser32 || + check_lib openssl openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 || die "ERROR: openssl not found"; } + enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create && - require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create && --- -2.10.1.windows.1 - diff --git a/tools/buildsteps/windows/patches/0002-ffmpeg-zlib-config-conflict.patch b/tools/buildsteps/windows/patches/0002-ffmpeg-zlib-config-conflict.patch index 632cc55bfb77..7896759375a0 100644 --- a/tools/buildsteps/windows/patches/0002-ffmpeg-zlib-config-conflict.patch +++ b/tools/buildsteps/windows/patches/0002-ffmpeg-zlib-config-conflict.patch @@ -1,6 +1,17 @@ +diff --git a/configure b/configure +index 34c2adb4a4..a2a2515525 100755 --- a/configure +++ b/configure -@@ -7197,6 +7197,9 @@ +@@ -6358,6 +6358,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || + check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || ++ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -llibssl -llibcrypto -lws2_32 -lgdi32 -ladvapi32 -luser32 || ++ check_lib openssl openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 || + die "ERROR: openssl not found"; } + enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init + enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create && +@@ -7437,6 +7439,9 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \ $CONFIG_EXTRA \ $ALL_COMPONENTS \ diff --git a/tools/buildsteps/windows/patches/0003-ffmpeg-static.patch b/tools/buildsteps/windows/patches/0003-ffmpeg-static.patch index fb78864a7d0f..6852ffc2d71e 100644 --- a/tools/buildsteps/windows/patches/0003-ffmpeg-static.patch +++ b/tools/buildsteps/windows/patches/0003-ffmpeg-static.patch @@ -1,6 +1,8 @@ +diff --git a/configure b/configure +index 34c2adb4a4..9c0ff0cd88 100755 --- a/configure +++ b/configure -@@ -5131,6 +5131,8 @@ +@@ -5312,6 +5312,8 @@ case $target_os in enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres enabled x86_32 && check_ldflags -Wl,--large-address-aware shlibdir_default="$bindir_default" @@ -9,7 +11,7 @@ SLIBPREF="" SLIBSUF=".dll" SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' -@@ -5180,6 +5182,8 @@ +@@ -5361,6 +5363,8 @@ case $target_os in fi enabled x86_32 && check_ldflags -LARGEADDRESSAWARE shlibdir_default="$bindir_default" @@ -18,3 +20,22 @@ SLIBPREF="" SLIBSUF=".dll" SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' +@@ -6358,6 +6362,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || + check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || ++ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -llibssl -llibcrypto -lws2_32 -lgdi32 -ladvapi32 -luser32 || ++ check_lib openssl openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 || + die "ERROR: openssl not found"; } + enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init + enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create && +@@ -7437,6 +7443,9 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \ + $CONFIG_EXTRA \ + $ALL_COMPONENTS \ + ++echo "#if defined(HAVE_UNISTD_H) && HAVE_UNISTD_H == 0" >> $TMPH ++echo "#undef HAVE_UNISTD_H" >> $TMPH ++echo "#endif" >> $TMPH + echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH + echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak + diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile index 8b513ed100ee..96ef2640e0b3 100644 --- a/tools/depends/target/Makefile +++ b/tools/depends/target/Makefile @@ -184,3 +184,4 @@ linux-system-libs: linux-system-libs-egl [ -f $(PREFIX)/lib/pkgconfig/xmu.pc ] || ln -sf /usr/lib/$(HOST)/pkgconfig/xmu.pc $(PREFIX)/lib/pkgconfig/xmu.pc [ -f $(PREFIX)/lib/pkgconfig/libdrm.pc ] || ln -sf /usr/lib/$(HOST)/pkgconfig/libdrm.pc $(PREFIX)/lib/pkgconfig/libdrm.pc [ -f $(PREFIX)/lib/pkgconfig/xkbcommon.pc ] || ln -sf /usr/lib/$(HOST)/pkgconfig/xkbcommon.pc $(PREFIX)/lib/pkgconfig/xkbcommon.pc + [ -f $(PREFIX)/lib/pkgconfig/libva.pc ] || ln -sf /usr/lib/$(HOST)/pkgconfig/libva.pc $(PREFIX)/lib/pkgconfig/libva.pc diff --git a/tools/depends/target/ffmpeg/FFMPEG-VERSION b/tools/depends/target/ffmpeg/FFMPEG-VERSION index 620fe798de97..d105be356ec5 100644 --- a/tools/depends/target/ffmpeg/FFMPEG-VERSION +++ b/tools/depends/target/ffmpeg/FFMPEG-VERSION @@ -1,4 +1,4 @@ LIBNAME=ffmpeg BASE_URL=https://github.com/xbmc/FFmpeg -VERSION=4.0.4-Leia-18.4 +VERSION=4.2.2-Matrix-Alpha1 ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz From e71b4cc63d03c31c49395015e54f631be08d23d1 Mon Sep 17 00:00:00 2001 From: peak3d Date: Sat, 15 Feb 2020 19:15:26 +0100 Subject: [PATCH 2/2] [ffmpeg] CActiveAEFilter: initialize frame pts only once after filter creation This fixes an issue when using the atempo filter after ffmpeg commit 181031906e4984c1c539dc84d21386a4397e257e --- .../cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp | 8 ++++++++ xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h | 1 + 2 files changed, 9 insertions(+) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp index 8dd0af4d713e..f950623dd218 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp @@ -157,6 +157,7 @@ bool CActiveAEFilter::CreateAtempoFilter() m_needData = true; m_filterEof = false; m_started = false; + m_ptsInitialized = false; return true; } @@ -182,6 +183,8 @@ void CActiveAEFilter::CloseFilter() m_SamplesIn = 0; m_SamplesOut = 0; + + m_ptsInitialized = false; } int CActiveAEFilter::ProcessFilter(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, int src_bufsize) @@ -211,6 +214,11 @@ int CActiveAEFilter::ProcessFilter(uint8_t **dst_buffer, int dst_samples, uint8_ frame->sample_rate = m_sampleRate; frame->nb_samples = src_samples; frame->format = m_sampleFormat; + if (!m_ptsInitialized) + { + frame->pts = 0; + m_ptsInitialized = true; + } m_SamplesIn += src_samples; diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h index e51502f89e85..8cb15e7e009e 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h @@ -52,6 +52,7 @@ class CActiveAEFilter bool m_started; bool m_hasData; bool m_needData; + bool m_ptsInitialized; int m_sampleOffset; int64_t m_SamplesIn; int64_t m_SamplesOut;