diff options
author | Jan Beich <jbeich@FreeBSD.org> | 2020-12-10 02:42:18 +0000 |
---|---|---|
committer | Jan Beich <jbeich@FreeBSD.org> | 2020-12-10 02:42:18 +0000 |
commit | 9539d5682495af533b7c98c1739fd4d835f0af8b (patch) | |
tree | fcc643533aae7f0ea4d44d2b4182a0b105d325ba /audio/webrtc-audio-processing0/files | |
parent | misc/py-toil: Update 4.2.0 -> 5.0.0 (diff) |
audio/webrtc-audio-processing: update to 1.0
Changes: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/compare/v0.3.1...v1.0
Reported by: Repology
Notes
Notes:
svn path=/head/; revision=557409
Diffstat (limited to 'audio/webrtc-audio-processing0/files')
6 files changed, 278 insertions, 0 deletions
diff --git a/audio/webrtc-audio-processing0/files/patch-big-endian b/audio/webrtc-audio-processing0/files/patch-big-endian new file mode 100644 index 000000000000..57daadce1870 --- /dev/null +++ b/audio/webrtc-audio-processing0/files/patch-big-endian @@ -0,0 +1,113 @@ +https://bugs.freedesktop.org/show_bug.cgi?id=95738 + +--- webrtc/common_audio/wav_file.cc.orig 2018-07-23 14:02:57 UTC ++++ webrtc/common_audio/wav_file.cc +@@ -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<uint32_t>(num_samples), + num_samples_remaining_); +@@ -76,6 +73,12 @@ size_t WavReader::ReadSamples(size_t num_samples, int1 + RTC_CHECK(read == num_samples || feof(file_handle_)); + RTC_CHECK_LE(read, num_samples_remaining_); + num_samples_remaining_ -= rtc::checked_cast<uint32_t>(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<uint32_t>(written); + RTC_CHECK(written <= std::numeric_limits<uint32_t>::max() || +--- webrtc/common_audio/wav_header.cc.orig 2018-07-23 14:02:57 UTC ++++ webrtc/common_audio/wav_header.cc +@@ -129,7 +129,39 @@ static inline std::string ReadFourCC(uint32_t x) { + return std::string(reinterpret_cast<char*>(&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<uint32_t>(a) << 24 ) ++ | (static_cast<uint32_t>(b) << 16) ++ | (static_cast<uint32_t>(c) << 8) ++ | (static_cast<uint32_t>(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<char*>(&x), 4); ++} + #endif + + static inline uint32_t RiffChunkSize(uint32_t bytes_in_payload) { +--- webrtc/typedefs.h.orig 2018-07-23 14:02:57 UTC ++++ webrtc/typedefs.h +@@ -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/audio/webrtc-audio-processing0/files/patch-configure.ac b/audio/webrtc-audio-processing0/files/patch-configure.ac new file mode 100644 index 000000000000..b41e30d1a20a --- /dev/null +++ b/audio/webrtc-audio-processing0/files/patch-configure.ac @@ -0,0 +1,18 @@ +- Add WEBRTC_BSD as it's closer to WEBRTC_LINUX than WEBRTC_MAC + +--- configure.ac.orig 2018-07-23 14:02:57 UTC ++++ configure.ac +@@ -63,6 +63,13 @@ AS_CASE(["${host}"], + OS_LDFLAGS="-lrt -lpthread" + HAVE_POSIX=1 + ], ++ [*-*dragonfly*|*-*bsd*], ++ [ ++ OS_CFLAGS="-DWEBRTC_BSD -DWEBRTC_THREAD_RR" ++ PLATFORM_CFLAGS="-DWEBRTC_POSIX" ++ OS_LDFLAGS="-lpthread" ++ HAVE_POSIX=1 ++ ], + [*-*darwin*], + [ + OS_CFLAGS="-DWEBRTC_MAC -DWEBRTC_THREAD_RR -DWEBRTC_CLOCK_TYPE_REALTIME" diff --git a/audio/webrtc-audio-processing0/files/patch-webrtc_base_checks.cc b/audio/webrtc-audio-processing0/files/patch-webrtc_base_checks.cc new file mode 100644 index 000000000000..82ffcf49c7ec --- /dev/null +++ b/audio/webrtc-audio-processing0/files/patch-webrtc_base_checks.cc @@ -0,0 +1,70 @@ +- Drop unnecessary dependency on libexecinfo for GCC build + https://chromium.googlesource.com/external/webrtc/+/7c4dedade158%5E!/ + +--- webrtc/base/checks.cc.orig 2018-07-23 14:02:57 UTC ++++ webrtc/base/checks.cc +@@ -11,16 +11,10 @@ + // Most of this was borrowed (with minor modifications) from V8's and Chromium's + // src/base/logging.cc. + +-// Use the C++ version to provide __GLIBCXX__. + #include <cstdarg> + #include <cstdio> + #include <cstdlib> + +-#if defined(__GLIBCXX__) && !defined(__UCLIBC__) +-#include <cxxabi.h> +-#include <execinfo.h> +-#endif +- + #if defined(WEBRTC_ANDROID) + #define LOG_TAG "rtc" + #include <android/log.h> // NOLINT +@@ -51,39 +45,6 @@ void PrintError(const char* format, ...) { + va_end(args); + } + +-// TODO(ajm): This works on Mac (although the parsing fails) but I don't seem +-// to get usable symbols on Linux. This is copied from V8. Chromium has a more +-// advanced stace trace system; also more difficult to copy. +-void DumpBacktrace() { +-#if defined(__GLIBCXX__) && !defined(__UCLIBC__) +- void* trace[100]; +- int size = backtrace(trace, sizeof(trace) / sizeof(*trace)); +- char** symbols = backtrace_symbols(trace, size); +- PrintError("\n==== C stack trace ===============================\n\n"); +- if (size == 0) { +- PrintError("(empty)\n"); +- } else if (symbols == NULL) { +- PrintError("(no symbols)\n"); +- } else { +- for (int i = 1; i < size; ++i) { +- char mangled[201]; +- if (sscanf(symbols[i], "%*[^(]%*[(]%200[^)+]", mangled) == 1) { // NOLINT +- PrintError("%2d: ", i); +- int status; +- size_t length; +- char* demangled = abi::__cxa_demangle(mangled, NULL, &length, &status); +- PrintError("%s\n", demangled != NULL ? demangled : mangled); +- free(demangled); +- } else { +- // If parsing failed, at least print the unparsed symbol. +- PrintError("%s\n", symbols[i]); +- } +- } +- } +- free(symbols); +-#endif +-} +- + FatalMessage::FatalMessage(const char* file, int line) { + Init(file, line); + } +@@ -99,7 +60,6 @@ NO_RETURN FatalMessage::~FatalMessage() { + fflush(stderr); + stream_ << std::endl << "#" << std::endl; + PrintError(stream_.str().c_str()); +- DumpBacktrace(); + fflush(stderr); + abort(); + } diff --git a/audio/webrtc-audio-processing0/files/patch-webrtc_base_platform__thread.cc b/audio/webrtc-audio-processing0/files/patch-webrtc_base_platform__thread.cc new file mode 100644 index 000000000000..23840052102e --- /dev/null +++ b/audio/webrtc-audio-processing0/files/patch-webrtc_base_platform__thread.cc @@ -0,0 +1,42 @@ +- Implement CurrentThreadId() using global thread ID +- Implement SetCurrentThreadName() + +--- webrtc/base/platform_thread.cc.orig 2018-07-23 14:02:57 UTC ++++ webrtc/base/platform_thread.cc +@@ -19,6 +19,12 @@ + #include <sys/syscall.h> + #endif + ++#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) // WEBRTC_BSD ++#include <pthread_np.h> ++#elif defined(__NetBSD__) // WEBRTC_BSD ++#include <lwp.h> ++#endif ++ + namespace rtc { + + PlatformThreadId CurrentThreadId() { +@@ -32,6 +38,12 @@ PlatformThreadId CurrentThreadId() { + ret = syscall(__NR_gettid); + #elif defined(WEBRTC_ANDROID) + ret = gettid(); ++#elif defined(__DragonFly__) || defined(__FreeBSD__) // WEBRTC_BSD ++ ret = pthread_getthreadid_np(); ++#elif defined(__NetBSD__) // WEBRTC_BSD ++ ret = _lwp_self(); ++#elif defined(__OpenBSD__) // WEBRTC_BSD ++ ret = getthrid(); + #else + // Default implementation for nacl and solaris. + ret = reinterpret_cast<pid_t>(pthread_self()); +@@ -76,6 +88,10 @@ void SetCurrentThreadName(const char* name) { + prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); + #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS) + pthread_setname_np(name); ++#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) // WEBRTC_BSD ++ pthread_set_name_np(pthread_self(), name); ++#elif defined(__NetBSD__) // WEBRTC_BSD ++ pthread_setname_np(pthread_self(), "%s", (void*)name); + #endif + } + diff --git a/audio/webrtc-audio-processing0/files/patch-webrtc_base_stringutils.h b/audio/webrtc-audio-processing0/files/patch-webrtc_base_stringutils.h new file mode 100644 index 000000000000..c01ec8a2c14b --- /dev/null +++ b/audio/webrtc-audio-processing0/files/patch-webrtc_base_stringutils.h @@ -0,0 +1,13 @@ +- BSD macro (in sys/param.h) is an archaic of the (University of California) past + +--- webrtc/base/stringutils.h.orig 2018-07-23 14:02:57 UTC ++++ webrtc/base/stringutils.h +@@ -23,7 +23,7 @@ + #endif // WEBRTC_WIN + + #if defined(WEBRTC_POSIX) +-#ifdef BSD ++#ifdef WEBRTC_BSD + #include <stdlib.h> + #else // BSD + #include <alloca.h> diff --git a/audio/webrtc-audio-processing0/files/patch-webrtc_system__wrappers_source_condition__variable.cc b/audio/webrtc-audio-processing0/files/patch-webrtc_system__wrappers_source_condition__variable.cc new file mode 100644 index 000000000000..b1c7dd0e2d06 --- /dev/null +++ b/audio/webrtc-audio-processing0/files/patch-webrtc_system__wrappers_source_condition__variable.cc @@ -0,0 +1,22 @@ +- Match conditional in webrtc/system_wrappers/Makefile.am + +--- webrtc/system_wrappers/source/condition_variable.cc.orig 2018-07-23 14:02:57 UTC ++++ webrtc/system_wrappers/source/condition_variable.cc +@@ -14,7 +14,7 @@ + #include <windows.h> + #include "webrtc/system_wrappers/source/condition_variable_event_win.h" + #include "webrtc/system_wrappers/source/condition_variable_native_win.h" +-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) ++#elif defined(WEBRTC_POSIX) + #include <pthread.h> + #include "webrtc/system_wrappers/source/condition_variable_posix.h" + #endif +@@ -31,7 +31,7 @@ ConditionVariableWrapper* ConditionVariableWrapper::Cr + ret_val = new ConditionVariableEventWin(); + } + return ret_val; +-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) ++#elif defined(WEBRTC_POSIX) + return ConditionVariablePosix::Create(); + #else + return NULL; |