commit 703c71b493759ab125e472136e16fc55bc3f28b4 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:19:48 2019 -0400 Package init diff --git a/webrtc-audio-processing-0.2-big-endian.patch b/webrtc-audio-processing-0.2-big-endian.patch new file mode 100644 index 0000000..9361725 --- /dev/null +++ b/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/webrtc-audio-processing-0.3.1.tar.xz b/webrtc-audio-processing-0.3.1.tar.xz new file mode 100644 index 0000000..f36e2ec Binary files /dev/null and b/webrtc-audio-processing-0.3.1.tar.xz differ diff --git a/webrtc-audio-processing.spec b/webrtc-audio-processing.spec new file mode 100644 index 0000000..0770b97 --- /dev/null +++ b/webrtc-audio-processing.spec @@ -0,0 +1,68 @@ +Name: webrtc-audio-processing +Version: 0.3.1 +Release: 2 +Summary: Real-Time Communication Library for Web Browsers +License: BSD and MIT +URL: https://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing/ +Source0: https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/%{name}-%{version}.tar.xz + +Patch0: webrtc-fix-typedefs-on-other-arches.patch +Patch1: webrtc-audio-processing-0.2-big-endian.patch + +BuildRequires: autoconf automake libtool gcc gcc-c++ + +%description +WebRTC is an open source project that enables web browsers with Real-Time +Communications (RTC) capabilities via simple Javascript APIs. The WebRTC +components have been optimized to best serve this purpose. + +WebRTC implements the W3C's proposal for video conferencing on the web. + +%package devel +Summary: Header files for webrtc-audio-processing +Requires: %{name} = %{version}-%{release} + +%description devel +Header files for webrtc-audio-processing + +%package_help + +%prep +%autosetup -n %{name}-%{version} -p1 + +%build +autoreconf -vif +%configure \ +%ifarch %{arm} aarch64 + --enable-neon=no \ +%endif + --disable-silent-rules +%make_build + +%install +%make_install + +%delete_la + +%ldconfig_scriptlets + +%files +%defattr(-,root,root) +%doc README.md AUTHORS +%license COPYING +%{_libdir}/libwebrtc_audio_processing.so.1* + +%files devel +%defattr(-,root,root) +%{_libdir}/*.a +%{_libdir}/pkgconfig/%{name}.pc +%{_libdir}/libwebrtc_audio_processing.so +%{_includedir}/webrtc_audio_processing/webrtc/* + +%files help +%defattr(-,root,root) +%doc NEWS + +%changelog +* Fri Sep 6 2019 openEuler Buildteam - 0.3.1-2 +- Package init diff --git a/webrtc-fix-typedefs-on-other-arches.patch b/webrtc-fix-typedefs-on-other-arches.patch new file mode 100644 index 0000000..81e5ae5 --- /dev/null +++ b/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))