diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..37bac44 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/webrtc-audio-processing-0.3.tar.xz diff --git a/.webrtc-audio-processing.metadata b/.webrtc-audio-processing.metadata new file mode 100644 index 0000000..8569362 --- /dev/null +++ b/.webrtc-audio-processing.metadata @@ -0,0 +1 @@ +65ed41129bcded398c37860ccb38a8cd7ae4dfe3 SOURCES/webrtc-audio-processing-0.3.tar.xz diff --git a/SOURCES/webrtc-audio-processing-0.2-big-endian.patch b/SOURCES/webrtc-audio-processing-0.2-big-endian.patch new file mode 100644 index 0000000..9361725 --- /dev/null +++ b/SOURCES/webrtc-audio-processing-0.2-big-endian.patch @@ -0,0 +1,90 @@ +diff -up webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc.than webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc +--- webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc.than 2016-05-24 08:28:45.749940095 -0400 ++++ webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc 2016-05-24 08:50:30.361020010 -0400 +@@ -64,9 +64,6 @@ WavReader::~WavReader() { + } + + size_t WavReader::ReadSamples(size_t num_samples, int16_t* samples) { +-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN +-#error "Need to convert samples to big-endian when reading from WAV file" +-#endif + // There could be metadata after the audio; ensure we don't read it. + num_samples = std::min(rtc::checked_cast(num_samples), + num_samples_remaining_); +@@ -76,6 +73,12 @@ size_t WavReader::ReadSamples(size_t num + RTC_CHECK(read == num_samples || feof(file_handle_)); + RTC_CHECK_LE(read, num_samples_remaining_); + num_samples_remaining_ -= rtc::checked_cast(read); ++#ifndef WEBRTC_ARCH_LITTLE_ENDIAN ++ //convert to big-endian ++ for(size_t idx = 0; idx < num_samples; idx++) { ++ samples[idx] = (samples[idx]<<8) | (samples[idx]>>8); ++ } ++#endif + return read; + } + +@@ -120,10 +123,17 @@ WavWriter::~WavWriter() { + + void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) { + #ifndef WEBRTC_ARCH_LITTLE_ENDIAN +-#error "Need to convert samples to little-endian when writing to WAV file" +-#endif ++ int16_t * le_samples = new int16_t[num_samples]; ++ for(size_t idx = 0; idx < num_samples; idx++) { ++ le_samples[idx] = (samples[idx]<<8) | (samples[idx]>>8); ++ } ++ const size_t written = ++ fwrite(le_samples, sizeof(*le_samples), num_samples, file_handle_); ++ delete []le_samples; ++#else + const size_t written = + fwrite(samples, sizeof(*samples), num_samples, file_handle_); ++#endif + RTC_CHECK_EQ(num_samples, written); + num_samples_ += static_cast(written); + RTC_CHECK(written <= std::numeric_limits::max() || +diff -up webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc.than webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc +--- webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc.than 2016-05-24 08:50:52.591379263 -0400 ++++ webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc 2016-05-24 08:52:08.552606848 -0400 +@@ -129,7 +129,39 @@ static inline std::string ReadFourCC(uin + return std::string(reinterpret_cast(&x), 4); + } + #else +-#error "Write be-to-le conversion functions" ++static inline void WriteLE16(uint16_t* f, uint16_t x) { ++ *f = ((x << 8) & 0xff00) | ( ( x >> 8) & 0x00ff); ++} ++ ++static inline void WriteLE32(uint32_t* f, uint32_t x) { ++ *f = ( (x & 0x000000ff) << 24 ) ++ | ((x & 0x0000ff00) << 8) ++ | ((x & 0x00ff0000) >> 8) ++ | ((x & 0xff000000) >> 24 ); ++} ++ ++static inline void WriteFourCC(uint32_t* f, char a, char b, char c, char d) { ++ *f = (static_cast(a) << 24 ) ++ | (static_cast(b) << 16) ++ | (static_cast(c) << 8) ++ | (static_cast(d) ); ++} ++ ++static inline uint16_t ReadLE16(uint16_t x) { ++ return (( x & 0x00ff) << 8 )| ((x & 0xff00)>>8); ++} ++ ++static inline uint32_t ReadLE32(uint32_t x) { ++ return ( (x & 0x000000ff) << 24 ) ++ | ( (x & 0x0000ff00) << 8 ) ++ | ( (x & 0x00ff0000) >> 8) ++ | ( (x & 0xff000000) >> 24 ); ++} ++ ++static inline std::string ReadFourCC(uint32_t x) { ++ x = ReadLE32(x); ++ return std::string(reinterpret_cast(&x), 4); ++} + #endif + + static inline uint32_t RiffChunkSize(uint32_t bytes_in_payload) { diff --git a/SOURCES/webrtc-audio-processing-0.3-neon.patch b/SOURCES/webrtc-audio-processing-0.3-neon.patch new file mode 100644 index 0000000..30145db --- /dev/null +++ b/SOURCES/webrtc-audio-processing-0.3-neon.patch @@ -0,0 +1,54 @@ +diff -up webrtc-audio-processing-0.3/configure.ac.neon webrtc-audio-processing-0.3/configure.ac +--- webrtc-audio-processing-0.3/configure.ac.neon 2016-06-22 01:46:41.000000000 -0500 ++++ webrtc-audio-processing-0.3/configure.ac 2016-07-18 08:01:43.541116030 -0500 +@@ -98,7 +98,7 @@ AS_IF([test "x$enable_neon" != "xno"], + ], + [ + HAVE_NEON=1 +- ARCH_CFLAGS="$ARCH_CFLAGS -DWEBRTC_DETECT_NEON -mfpu=neon" ++ ARCH_CFLAGS="$ARCH_CFLAGS -DWEBRTC_DETECT_NEON" + ]) + ) + AM_CONDITIONAL([HAVE_NEON], [test "x$HAVE_NEON" = "x1"]) +diff -up webrtc-audio-processing-0.3/webrtc/common_audio/Makefile.am.neon webrtc-audio-processing-0.3/webrtc/common_audio/Makefile.am +--- webrtc-audio-processing-0.3/webrtc/common_audio/Makefile.am.neon 2016-06-21 06:16:05.000000000 -0500 ++++ webrtc-audio-processing-0.3/webrtc/common_audio/Makefile.am 2016-07-18 07:40:02.128151244 -0500 +@@ -118,13 +118,18 @@ libcommon_audio_la_SOURCES += \ + endif + + if HAVE_NEON +-libcommon_audio_la_SOURCES += \ ++noinst_LTLIBRARIES += libcommon_audio_neon.la ++libcommon_audio_neon_la_SOURCES = \ + resampler/sinc_resampler_neon.cc \ + signal_processing/cross_correlation_neon.c \ + signal_processing/downsample_fast_neon.c \ + signal_processing/min_max_operations_neon.c \ + fir_filter_neon.cc \ + fir_filter_neon.h ++ ++libcommon_audio_neon_la_CFLAGS = -mfpu=neon $(AM_CFLAGS) $(COMMON_CFLAGS) -mfpu=neon ++libcommon_audio_neon_la_CXXFLAGS = -mfpu=neon $(AM_CXXFLAGS) $(COMMON_CXXFLAGS) -mfpu=neon ++libcommon_audio_neon_la_LDFLAGS = $(AM_LDFLAGS) + endif + + if !HAVE_ARM +diff -up webrtc-audio-processing-0.3/webrtc/modules/audio_processing/Makefile.am.neon webrtc-audio-processing-0.3/webrtc/modules/audio_processing/Makefile.am +--- webrtc-audio-processing-0.3/webrtc/modules/audio_processing/Makefile.am.neon 2016-06-21 06:15:34.000000000 -0500 ++++ webrtc-audio-processing-0.3/webrtc/modules/audio_processing/Makefile.am 2016-07-18 07:40:02.128151244 -0500 +@@ -158,10 +158,15 @@ libwebrtc_audio_processing_privatearch_l + endif + + if HAVE_NEON ++noinst_LTLIBRARIES = libwebrtc_audio_processing_privatearch.la ++LIBWEBRTC_PRIVATEARCH=libwebrtc_audio_processing_privatearch.la + libwebrtc_audio_processing_la_SOURCES += \ + aec/aec_core_neon.c \ + aec/aec_rdft_neon.c \ + aecm/aecm_core_neon.c ++libwebrtc_audio_processing_privatearch_la_CFLAGS = -mfpu=neon $(AM_CFLAGS) $(COMMON_CFLAGS) -mfpu=neon ++libwebrtc_audio_processing_privatearch_la_CXXFLAGS = -mfpu=neon $(AM_CXXFLAGS) $(COMMON_CXXFLAGS) -mfpu-neon ++libwebrtc_audio_processing_privatearch_la_LDFLAGS = $(AM_LDFLAGS) + endif + + libwebrtc_audio_processing_la_CFLAGS = $(AM_CFLAGS) $(COMMON_CFLAGS) diff --git a/SOURCES/webrtc-fix-typedefs-on-other-arches.patch b/SOURCES/webrtc-fix-typedefs-on-other-arches.patch new file mode 100644 index 0000000..81e5ae5 --- /dev/null +++ b/SOURCES/webrtc-fix-typedefs-on-other-arches.patch @@ -0,0 +1,24 @@ +diff -up webrtc-audio-processing-0.2/webrtc/typedefs.h.typedef webrtc-audio-processing-0.2/webrtc/typedefs.h +--- webrtc-audio-processing-0.2/webrtc/typedefs.h.typedef 2016-05-12 09:08:53.885000410 -0500 ++++ webrtc-audio-processing-0.2/webrtc/typedefs.h 2016-05-12 09:12:38.006851953 -0500 +@@ -48,7 +48,19 @@ + #define WEBRTC_ARCH_32_BITS + #define WEBRTC_ARCH_LITTLE_ENDIAN + #else +-#error Please add support for your architecture in typedefs.h ++/* instead of failing, use typical unix defines... */ ++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ++#define WEBRTC_ARCH_LITTLE_ENDIAN ++#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++#define WEBRTC_ARCH_BIG_ENDIAN ++#else ++#error __BYTE_ORDER__ is not defined ++#endif ++#if defined(__LP64__) ++#define WEBRTC_ARCH_64_BITS ++#else ++#define WEBRTC_ARCH_32_BITS ++#endif + #endif + + #if !(defined(WEBRTC_ARCH_LITTLE_ENDIAN) ^ defined(WEBRTC_ARCH_BIG_ENDIAN)) diff --git a/SPECS/webrtc-audio-processing.spec b/SPECS/webrtc-audio-processing.spec new file mode 100644 index 0000000..5d0be36 --- /dev/null +++ b/SPECS/webrtc-audio-processing.spec @@ -0,0 +1,150 @@ + +Name: webrtc-audio-processing +Version: 0.3 +Release: 1%{?dist} +Summary: Library for echo cancellation + +License: BSD +URL: http://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing/ +Source0: http://freedesktop.org/software/pulseaudio/webrtc-audio-processing/%{name}-%{version}.tar.xz + +Patch0: webrtc-fix-typedefs-on-other-arches.patch +# WIP to only explicitly add -mfpu=neon where needed for neon runtime detection +# currently doesn't work due to %%configure injecting incompatible CFLAGS atm, see below +Patch1: webrtc-audio-processing-0.3-neon.patch +# bz#1336466, https://bugs.freedesktop.org/show_bug.cgi?id=95738 +Patch4: webrtc-audio-processing-0.2-big-endian.patch + +BuildRequires: automake libtool + +%description +%{name} is a library derived from Google WebRTC project that +provides echo cancellation functionality. This library is used by for example +PulseAudio to provide echo cancellation. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header +files for developing applications that use %{name}. + +%prep +%setup -q +%patch0 -p1 -b .typedef +%patch1 -p1 -b .neon +%patch4 -p1 -b .bigendian + +# for patch1 +autoreconf -fi + + +%build + +%ifarch %{arm} +# disable neon support +# can't unconditionally enable neon, and --enable-neon=runtime is broken (WebRtc_GetCPUFeaturesARM is unimplemented) +%global neon --enable-neon=no +## hack to ensure -mfpu=neon flag appears last when using --enable-neon=yes|runtime +#export CFLAGS="%{optflags} -mfpu=neon" +#export CXXFLAGS="%{optflags} -mfpu=neon" +## except that enables it for *all* objects, not just the ones we want (see patch1), +## seems CFLAGS always trumps project flags, see also: +## http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html +%endif + +%configure \ + %{?neon} \ + --disable-silent-rules \ + --disable-static + +make %{?_smp_mflags} + + +%install +make install DESTDIR=%{buildroot} INSTALL="install -p" + +## unpackaged files +rm -fv %{buildroot}%{_libdir}/lib*.la + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + + +%files +%doc NEWS AUTHORS README.md +%license COPYING +%{_libdir}/libwebrtc_audio_processing.so.1* + +%files devel +%{_libdir}/libwebrtc_audio_processing.so +%{_libdir}/pkgconfig/webrtc-audio-processing.pc +%{_includedir}/webrtc_audio_processing/ + + +%changelog +* Mon Jul 18 2016 Rex Dieter - 0.3-1 +- 0.3 + +* Fri May 27 2016 Rex Dieter - 0.2-7 +- better/upstreamable x86_msse2.patch + +* Fri May 27 2016 Rex Dieter - 0.2-6 +- simpler/upstreamable no_undefined.patch (fdo#96244) + +* Wed May 25 2016 Than Ngo - 0.2-5 +- add url to upstream bug report + +* Tue May 24 2016 Than Ngo - 0.2-4 +- add support big endian + +* Mon May 16 2016 Rex Dieter - 0.2-3 +- ExclusiveArch primary archs, FTBFS on big endian arches (#1336466) + +* Mon May 16 2016 Rex Dieter - 0.2-2 +- link w/ --no-undefined +- fix x86 sse2 runtime detection + +* Thu May 12 2016 Rex Dieter - 0.2-1 +- webrtc-audio-processing-0.2 (#1335536) +- %%files: track ABI/API closer + +* Fri Feb 05 2016 Fedora Release Engineering - 0.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Jun 19 2015 Fedora Release Engineering - 0.1-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat May 02 2015 Kalev Lember - 0.1-9 +- Rebuilt for GCC 5 C++11 ABI change + +* Mon Aug 18 2014 Fedora Release Engineering - 0.1-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 0.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Wed Feb 26 2014 Debarshi Ray - 0.1-5 +- Fix FTBFS on non-x86/arm + Resolves: #1068823 + +* Tue Jan 28 2014 Kyle McMartin - 0.1-6 +- webrtc-fix-typedefs-on-other-arches.patch: fix ftbfs on non-x86/arm due to + a build #error in typedefs.h, however, the defines are not used anywhere in + the code. Fixes build on ppc{,64}, s390x, and aarch64. + +* Fri Dec 27 2013 Daniel Mach - 0.1-4 +- Mass rebuild 2013-12-27 + +* Thu Jul 11 2013 Debarshi Ray 0.1-4 +- Rebuilt to fix broken binary possibly caused by broken toolchain + +* Fri Feb 15 2013 Fedora Release Engineering - 0.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Tue Oct 9 2012 Dan HorĂ¡k 0.1-2 +- set ExclusiveArch x86 and ARM for now + +* Fri Oct 5 2012 Christian Schaller 0.1-1 +- Initial Fedora spec.