Compare commits

...

No commits in common. 'c9' and 'cs10' have entirely different histories.
c9 ... cs10

4
.gitignore vendored

@ -1 +1,3 @@
SOURCES/webrtc-audio-processing-0.3.1.tar.xz SOURCES/abseil-cpp-20230125.1.tar.gz
SOURCES/abseil-cpp_20230125.1-4_patch.zip
SOURCES/webrtc-audio-processing-1.3.tar.xz

@ -1 +1,3 @@
7aa63a6bfe0e5056cfcf883b2de3496ab214ac13 SOURCES/webrtc-audio-processing-0.3.1.tar.xz 609817274bf327339efc8488bb773d5f633ada62 SOURCES/abseil-cpp-20230125.1.tar.gz
11b3e50fd05da4c77f270ae7167a44539ab34e59 SOURCES/abseil-cpp_20230125.1-4_patch.zip
f7cd684db4429722e7f8d8ed6559094aaf4dfc18 SOURCES/webrtc-audio-processing-1.3.tar.xz

@ -0,0 +1,313 @@
--- a/webrtc/common_audio/wav_file.cc
+++ b/webrtc/common_audio/wav_file.cc
@@ -10,6 +10,7 @@
#include "common_audio/wav_file.h"
+#include <byteswap.h>
#include <errno.h>
#include <algorithm>
@@ -34,6 +35,38 @@ bool FormatSupported(WavFormat format) {
format == WavFormat::kWavFormatIeeeFloat;
}
+template <typename T>
+void TranslateEndianness(T* destination, const T* source, size_t length) {
+ static_assert(sizeof(T) == 2 || sizeof(T) == 4 || sizeof(T) == 8,
+ "no converter, use integral types");
+ if (sizeof(T) == 2) {
+ const uint16_t* src = reinterpret_cast<const uint16_t*>(source);
+ uint16_t* dst = reinterpret_cast<uint16_t*>(destination);
+ for (size_t index = 0; index < length; index++) {
+ dst[index] = bswap_16(src[index]);
+ }
+ }
+ if (sizeof(T) == 4) {
+ const uint32_t* src = reinterpret_cast<const uint32_t*>(source);
+ uint32_t* dst = reinterpret_cast<uint32_t*>(destination);
+ for (size_t index = 0; index < length; index++) {
+ dst[index] = bswap_32(src[index]);
+ }
+ }
+ if (sizeof(T) == 8) {
+ const uint64_t* src = reinterpret_cast<const uint64_t*>(source);
+ uint64_t* dst = reinterpret_cast<uint64_t*>(destination);
+ for (size_t index = 0; index < length; index++) {
+ dst[index] = bswap_64(src[index]);
+ }
+ }
+}
+
+template <typename T>
+void TranslateEndianness(T* buffer, size_t length) {
+ TranslateEndianness(buffer, buffer, length);
+}
+
// Doesn't take ownership of the file handle and won't close it.
class WavHeaderFileReader : public WavHeaderReader {
public:
@@ -89,10 +122,6 @@ void WavReader::Reset() {
size_t WavReader::ReadSamples(const size_t num_samples,
int16_t* const samples) {
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Need to convert samples to big-endian when reading from WAV file"
-#endif
-
size_t num_samples_left_to_read = num_samples;
size_t next_chunk_start = 0;
while (num_samples_left_to_read > 0 && num_unread_samples_ > 0) {
@@ -105,6 +134,9 @@ size_t WavReader::ReadSamples(const size_t num_samples,
num_bytes_read = file_.Read(samples_to_convert.data(),
chunk_size * sizeof(samples_to_convert[0]));
num_samples_read = num_bytes_read / sizeof(samples_to_convert[0]);
+#ifdef WEBRTC_ARCH_BIG_ENDIAN
+ TranslateEndianness(samples_to_convert.data(), num_samples_read);
+#endif
for (size_t j = 0; j < num_samples_read; ++j) {
samples[next_chunk_start + j] = FloatToS16(samples_to_convert[j]);
@@ -114,6 +146,10 @@ size_t WavReader::ReadSamples(const size_t num_samples,
num_bytes_read = file_.Read(&samples[next_chunk_start],
chunk_size * sizeof(samples[0]));
num_samples_read = num_bytes_read / sizeof(samples[0]);
+
+#ifdef WEBRTC_ARCH_BIG_ENDIAN
+ TranslateEndianness(&samples[next_chunk_start], num_samples_read);
+#endif
}
RTC_CHECK(num_samples_read == 0 || (num_bytes_read % num_samples_read) == 0)
<< "Corrupt file: file ended in the middle of a sample.";
@@ -129,10 +165,6 @@ size_t WavReader::ReadSamples(const size_t num_samples,
}
size_t WavReader::ReadSamples(const size_t num_samples, float* const samples) {
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Need to convert samples to big-endian when reading from WAV file"
-#endif
-
size_t num_samples_left_to_read = num_samples;
size_t next_chunk_start = 0;
while (num_samples_left_to_read > 0 && num_unread_samples_ > 0) {
@@ -145,6 +177,9 @@ size_t WavReader::ReadSamples(const size_t num_samples, float* const samples) {
num_bytes_read = file_.Read(samples_to_convert.data(),
chunk_size * sizeof(samples_to_convert[0]));
num_samples_read = num_bytes_read / sizeof(samples_to_convert[0]);
+#ifdef WEBRTC_ARCH_BIG_ENDIAN
+ TranslateEndianness(samples_to_convert.data(), num_samples_read);
+#endif
for (size_t j = 0; j < num_samples_read; ++j) {
samples[next_chunk_start + j] =
@@ -155,6 +190,9 @@ size_t WavReader::ReadSamples(const size_t num_samples, float* const samples) {
num_bytes_read = file_.Read(&samples[next_chunk_start],
chunk_size * sizeof(samples[0]));
num_samples_read = num_bytes_read / sizeof(samples[0]);
+#ifdef WEBRTC_ARCH_BIG_ENDIAN
+ TranslateEndianness(&samples[next_chunk_start], num_samples_read);
+#endif
for (size_t j = 0; j < num_samples_read; ++j) {
samples[next_chunk_start + j] =
@@ -213,24 +251,32 @@ WavWriter::WavWriter(FileWrapper file,
}
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
-
for (size_t i = 0; i < num_samples; i += kMaxChunksize) {
const size_t num_remaining_samples = num_samples - i;
const size_t num_samples_to_write =
std::min(kMaxChunksize, num_remaining_samples);
if (format_ == WavFormat::kWavFormatPcm) {
+#ifndef WEBRTC_ARCH_BIG_ENDIAN
RTC_CHECK(
file_.Write(&samples[i], num_samples_to_write * sizeof(samples[0])));
+#else
+ std::array<int16_t, kMaxChunksize> converted_samples;
+ TranslateEndianness(converted_samples.data(), &samples[i],
+ num_samples_to_write);
+ RTC_CHECK(
+ file_.Write(converted_samples.data(),
+ num_samples_to_write * sizeof(converted_samples[0])));
+#endif
} else {
RTC_CHECK_EQ(format_, WavFormat::kWavFormatIeeeFloat);
std::array<float, kMaxChunksize> converted_samples;
for (size_t j = 0; j < num_samples_to_write; ++j) {
converted_samples[j] = S16ToFloat(samples[i + j]);
}
+#ifdef WEBRTC_ARCH_BIG_ENDIAN
+ TranslateEndianness(converted_samples.data(), num_samples_to_write);
+#endif
RTC_CHECK(
file_.Write(converted_samples.data(),
num_samples_to_write * sizeof(converted_samples[0])));
@@ -243,10 +289,6 @@ void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) {
}
void WavWriter::WriteSamples(const float* samples, size_t num_samples) {
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Need to convert samples to little-endian when writing to WAV file"
-#endif
-
for (size_t i = 0; i < num_samples; i += kMaxChunksize) {
const size_t num_remaining_samples = num_samples - i;
const size_t num_samples_to_write =
@@ -257,6 +299,9 @@ void WavWriter::WriteSamples(const float* samples, size_t num_samples) {
for (size_t j = 0; j < num_samples_to_write; ++j) {
converted_samples[j] = FloatS16ToS16(samples[i + j]);
}
+#ifdef WEBRTC_ARCH_BIG_ENDIAN
+ TranslateEndianness(converted_samples.data(), num_samples_to_write);
+#endif
RTC_CHECK(
file_.Write(converted_samples.data(),
num_samples_to_write * sizeof(converted_samples[0])));
@@ -266,6 +311,9 @@ void WavWriter::WriteSamples(const float* samples, size_t num_samples) {
for (size_t j = 0; j < num_samples_to_write; ++j) {
converted_samples[j] = FloatS16ToFloat(samples[i + j]);
}
+#ifdef WEBRTC_ARCH_BIG_ENDIAN
+ TranslateEndianness(converted_samples.data(), num_samples_to_write);
+#endif
RTC_CHECK(
file_.Write(converted_samples.data(),
num_samples_to_write * sizeof(converted_samples[0])));
--- a/webrtc/common_audio/wav_header.cc
+++ b/webrtc/common_audio/wav_header.cc
@@ -14,6 +14,8 @@
#include "common_audio/wav_header.h"
+#include <endian.h>
+
#include <cstring>
#include <limits>
#include <string>
@@ -26,10 +28,6 @@
namespace webrtc {
namespace {
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Code not working properly for big endian platforms."
-#endif
-
#pragma pack(2)
struct ChunkHeader {
uint32_t ID;
@@ -174,6 +172,8 @@ bool FindWaveChunk(ChunkHeader* chunk_header,
if (readable->Read(chunk_header, sizeof(*chunk_header)) !=
sizeof(*chunk_header))
return false; // EOF.
+ chunk_header->Size = le32toh(chunk_header->Size);
+
if (ReadFourCC(chunk_header->ID) == sought_chunk_id)
return true; // Sought chunk found.
// Ignore current chunk by skipping its payload.
@@ -187,6 +187,13 @@ bool ReadFmtChunkData(FmtPcmSubchunk* fmt_subchunk, WavHeaderReader* readable) {
if (readable->Read(&(fmt_subchunk->AudioFormat), kFmtPcmSubchunkSize) !=
kFmtPcmSubchunkSize)
return false;
+ fmt_subchunk->AudioFormat = le16toh(fmt_subchunk->AudioFormat);
+ fmt_subchunk->NumChannels = le16toh(fmt_subchunk->NumChannels);
+ fmt_subchunk->SampleRate = le32toh(fmt_subchunk->SampleRate);
+ fmt_subchunk->ByteRate = le32toh(fmt_subchunk->ByteRate);
+ fmt_subchunk->BlockAlign = le16toh(fmt_subchunk->BlockAlign);
+ fmt_subchunk->BitsPerSample = le16toh(fmt_subchunk->BitsPerSample);
+
const uint32_t fmt_size = fmt_subchunk->header.Size;
if (fmt_size != kFmtPcmSubchunkSize) {
// There is an optional two-byte extension field permitted to be present
@@ -214,19 +221,22 @@ void WritePcmWavHeader(size_t num_channels,
auto header = rtc::MsanUninitialized<WavHeaderPcm>({});
const size_t bytes_in_payload = bytes_per_sample * num_samples;
- header.riff.header.ID = PackFourCC('R', 'I', 'F', 'F');
- header.riff.header.Size = RiffChunkSize(bytes_in_payload, *header_size);
- header.riff.Format = PackFourCC('W', 'A', 'V', 'E');
- header.fmt.header.ID = PackFourCC('f', 'm', 't', ' ');
- header.fmt.header.Size = kFmtPcmSubchunkSize;
- header.fmt.AudioFormat = MapWavFormatToHeaderField(WavFormat::kWavFormatPcm);
- header.fmt.NumChannels = static_cast<uint16_t>(num_channels);
- header.fmt.SampleRate = sample_rate;
- header.fmt.ByteRate = ByteRate(num_channels, sample_rate, bytes_per_sample);
- header.fmt.BlockAlign = BlockAlign(num_channels, bytes_per_sample);
- header.fmt.BitsPerSample = static_cast<uint16_t>(8 * bytes_per_sample);
- header.data.header.ID = PackFourCC('d', 'a', 't', 'a');
- header.data.header.Size = static_cast<uint32_t>(bytes_in_payload);
+ header.riff.header.ID = htole32(PackFourCC('R', 'I', 'F', 'F'));
+ header.riff.header.Size =
+ htole32(RiffChunkSize(bytes_in_payload, *header_size));
+ header.riff.Format = htole32(PackFourCC('W', 'A', 'V', 'E'));
+ header.fmt.header.ID = htole32(PackFourCC('f', 'm', 't', ' '));
+ header.fmt.header.Size = htole32(kFmtPcmSubchunkSize);
+ header.fmt.AudioFormat =
+ htole16(MapWavFormatToHeaderField(WavFormat::kWavFormatPcm));
+ header.fmt.NumChannels = htole16(num_channels);
+ header.fmt.SampleRate = htole32(sample_rate);
+ header.fmt.ByteRate =
+ htole32(ByteRate(num_channels, sample_rate, bytes_per_sample));
+ header.fmt.BlockAlign = htole16(BlockAlign(num_channels, bytes_per_sample));
+ header.fmt.BitsPerSample = htole16(8 * bytes_per_sample);
+ header.data.header.ID = htole32(PackFourCC('d', 'a', 't', 'a'));
+ header.data.header.Size = htole32(bytes_in_payload);
// Do an extra copy rather than writing everything to buf directly, since buf
// might not be correctly aligned.
@@ -245,24 +255,26 @@ void WriteIeeeFloatWavHeader(size_t num_channels,
auto header = rtc::MsanUninitialized<WavHeaderIeeeFloat>({});
const size_t bytes_in_payload = bytes_per_sample * num_samples;
- header.riff.header.ID = PackFourCC('R', 'I', 'F', 'F');
- header.riff.header.Size = RiffChunkSize(bytes_in_payload, *header_size);
- header.riff.Format = PackFourCC('W', 'A', 'V', 'E');
- header.fmt.header.ID = PackFourCC('f', 'm', 't', ' ');
- header.fmt.header.Size = kFmtIeeeFloatSubchunkSize;
+ header.riff.header.ID = htole32(PackFourCC('R', 'I', 'F', 'F'));
+ header.riff.header.Size =
+ htole32(RiffChunkSize(bytes_in_payload, *header_size));
+ header.riff.Format = htole32(PackFourCC('W', 'A', 'V', 'E'));
+ header.fmt.header.ID = htole32(PackFourCC('f', 'm', 't', ' '));
+ header.fmt.header.Size = htole32(kFmtIeeeFloatSubchunkSize);
header.fmt.AudioFormat =
- MapWavFormatToHeaderField(WavFormat::kWavFormatIeeeFloat);
- header.fmt.NumChannels = static_cast<uint16_t>(num_channels);
- header.fmt.SampleRate = sample_rate;
- header.fmt.ByteRate = ByteRate(num_channels, sample_rate, bytes_per_sample);
- header.fmt.BlockAlign = BlockAlign(num_channels, bytes_per_sample);
- header.fmt.BitsPerSample = static_cast<uint16_t>(8 * bytes_per_sample);
- header.fmt.ExtensionSize = 0;
- header.fact.header.ID = PackFourCC('f', 'a', 'c', 't');
- header.fact.header.Size = 4;
- header.fact.SampleLength = static_cast<uint32_t>(num_channels * num_samples);
- header.data.header.ID = PackFourCC('d', 'a', 't', 'a');
- header.data.header.Size = static_cast<uint32_t>(bytes_in_payload);
+ htole16(MapWavFormatToHeaderField(WavFormat::kWavFormatIeeeFloat));
+ header.fmt.NumChannels = htole16(num_channels);
+ header.fmt.SampleRate = htole32(sample_rate);
+ header.fmt.ByteRate =
+ htole32(ByteRate(num_channels, sample_rate, bytes_per_sample));
+ header.fmt.BlockAlign = htole16(BlockAlign(num_channels, bytes_per_sample));
+ header.fmt.BitsPerSample = htole16(8 * bytes_per_sample);
+ header.fmt.ExtensionSize = htole16(0);
+ header.fact.header.ID = htole32(PackFourCC('f', 'a', 'c', 't'));
+ header.fact.header.Size = htole32(4);
+ header.fact.SampleLength = htole32(num_channels * num_samples);
+ header.data.header.ID = htole32(PackFourCC('d', 'a', 't', 'a'));
+ header.data.header.Size = htole32(bytes_in_payload);
// Do an extra copy rather than writing everything to buf directly, since buf
// might not be correctly aligned.
@@ -391,6 +403,7 @@ bool ReadWavHeader(WavHeaderReader* readable,
return false;
if (ReadFourCC(header.riff.Format) != "WAVE")
return false;
+ header.riff.header.Size = le32toh(header.riff.header.Size);
// Find "fmt " and "data" chunks. While the official Wave file specification
// does not put requirements on the chunks order, it is uncommon to find the

@ -0,0 +1,86 @@
--- webrtc-audio-processing-1.3/webrtc/rtc_base/system/arch.h 2023-09-05 10:19:47.000000000 -0500
+++ webrtc-audio-processing-1.3/webrtc/rtc_base/system/arch.h 2024-02-12 10:04:12.114812565 -0600
@@ -15,8 +15,9 @@
#define RTC_BASE_SYSTEM_ARCH_H_
// Processor architecture detection. For more info on what's defined, see:
-// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
-// http://www.agner.org/optimize/calling_conventions.pdf
+// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
+// https://www.agner.org/optimize/calling_conventions.pdf
+// https://sourceforge.net/p/predef/wiki/Architectures/
// or with gcc, run: "echo | gcc -E -dM -"
#if defined(_M_X64) || defined(__x86_64__)
#define WEBRTC_ARCH_X86_FAMILY
@@ -27,29 +28,50 @@
#define WEBRTC_ARCH_ARM_FAMILY
#define WEBRTC_ARCH_64_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN
-#elif defined(__riscv) || defined(__riscv__)
-#define WEBRTC_ARCH_LITTLE_ENDIAN
-#if __riscv_xlen == 64
-#define WEBRTC_ARCH_64_BITS
-#else
-#define WEBRTC_ARCH_32_BITS
-#endif
#elif defined(_M_IX86) || defined(__i386__)
#define WEBRTC_ARCH_X86_FAMILY
#define WEBRTC_ARCH_X86
#define WEBRTC_ARCH_32_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN
-#elif defined(__ARMEL__)
+#elif defined(_M_ARM) || defined(__ARMEL__)
#define WEBRTC_ARCH_ARM_FAMILY
#define WEBRTC_ARCH_32_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN
-#elif defined(__MIPSEL__)
+#elif defined(__MIPSEL__) || defined(__MIPSEB__)
#define WEBRTC_ARCH_MIPS_FAMILY
#if defined(__LP64__)
#define WEBRTC_ARCH_64_BITS
#else
#define WEBRTC_ARCH_32_BITS
#endif
+#if defined(__MIPSEL__)
+#define WEBRTC_ARCH_LITTLE_ENDIAN
+#else
+#define WEBRTC_ARCH_BIG_ENDIAN
+#endif
+#elif defined(__PPC__)
+#if defined(__PPC64__)
+#define WEBRTC_ARCH_64_BITS
+#else
+#define WEBRTC_ARCH_32_BITS
+#endif
+#if defined(__LITTLE_ENDIAN__)
+#define WEBRTC_ARCH_LITTLE_ENDIAN
+#else
+#define WEBRTC_ARCH_BIG_ENDIAN
+#endif
+#elif defined(__sparc) || defined(__sparc__)
+#if __SIZEOF_LONG__ == 8
+#define WEBRTC_ARCH_64_BITS
+#else
+#define WEBRTC_ARCH_32_BITS
+#endif
+#define WEBRTC_ARCH_BIG_ENDIAN
+#elif defined(__riscv) && __riscv_xlen == 64
+#define WEBRTC_ARCH_64_BITS
+#define WEBRTC_ARCH_LITTLE_ENDIAN
+#elif defined(__riscv) && __riscv_xlen == 32
+#define WEBRTC_ARCH_32_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN
#elif defined(__pnacl__)
#define WEBRTC_ARCH_32_BITS
--- webrtc-audio-processing-1.3/webrtc/rtc_base/system/arch.h~ 2024-02-12 10:14:11.277835532 -0600
+++ webrtc-audio-processing-1.3/webrtc/rtc_base/system/arch.h 2024-02-12 10:25:11.558554823 -0600
@@ -79,6 +79,9 @@
#elif defined(__EMSCRIPTEN__)
#define WEBRTC_ARCH_32_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN
+#elif defined(__s390x__)
+#define WEBRTC_ARCH_64_BITS
+#define WEBRTC_ARCH_BIG_ENDIAN
#else
#error Please add support for your architecture in rtc_base/system/arch.h
#endif

@ -0,0 +1,17 @@
diff -ru webrtc-audio-processing-1.3.old/subprojects/abseil-cpp.wrap webrtc-audio-processing-1.3/subprojects/abseil-cpp.wrap
--- webrtc-audio-processing-1.3.old/subprojects/abseil-cpp.wrap 2023-09-05 17:19:47.000000000 +0200
+++ webrtc-audio-processing-1.3/subprojects/abseil-cpp.wrap 2024-07-12 17:45:02.377170755 +0200
@@ -1,13 +1,7 @@
[wrap-file]
directory = abseil-cpp-20230125.1
-source_url = https://github.com/abseil/abseil-cpp/archive/20230125.1.tar.gz
source_filename = abseil-cpp-20230125.1.tar.gz
-source_hash = 81311c17599b3712069ded20cca09a62ab0bf2a89dfa16993786c8782b7ed145
patch_filename = abseil-cpp_20230125.1-4_patch.zip
-patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20230125.1-4/get_patch
-patch_hash = 112ee72052049d930396c2778fc1c6e184137905dd75d60a97dcfc386426610d
-source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/abseil-cpp_20230125.1-4/abseil-cpp-20230125.1.tar.gz
-wrapdb_version = 20230125.1-4
[provide]
absl_base = absl_base_dep

@ -1,90 +0,0 @@
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<uint32_t>(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<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() ||
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<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) {

@ -1,24 +0,0 @@
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))

@ -1,21 +1,23 @@
Name: webrtc-audio-processing Name: webrtc-audio-processing
Version: 0.3.1 Version: 1.3
Release: 8%{?dist} Release: 5%{?dist}
Summary: Library for echo cancellation Summary: Library for echo cancellation
License: BSD and MIT License: BSD-3-Clause
URL: http://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing/ URL: http://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing/
Source0: http://freedesktop.org/software/pulseaudio/webrtc-audio-processing/%{name}-%{version}.tar.xz Source0: http://freedesktop.org/software/pulseaudio/webrtc-audio-processing/%{name}-%{version}.tar.xz
Source1: abseil-cpp-20230125.1.tar.gz
Source2: abseil-cpp_20230125.1-4_patch.zip
## upstream patches
Patch100: webrtc-fix-typedefs-on-other-arches.patch Patch0: arches.patch
# bz#1336466, https://bugs.freedesktop.org/show_bug.cgi?id=95738 Patch1: 65f002e.patch
Patch104: webrtc-audio-processing-0.2-big-endian.patch Patch2: build-abseil-cpp-from-local-tarbal.patch
BuildRequires: make BuildRequires: meson
BuildRequires: autoconf automake libtool
BuildRequires: gcc gcc-c++ BuildRequires: gcc gcc-c++
#BuildRequires: abseil-cpp-devel
#BuildRequires: neon-devel
%description %description
%{name} is a library derived from Google WebRTC project that %{name} is a library derived from Google WebRTC project that
@ -33,47 +35,72 @@ files for developing applications that use %{name}.
%prep %prep
%autosetup -p1 %autosetup -p1
%build mkdir subprojects/packagefiles
# for patch1 cp %{SOURCE1} subprojects/packagefiles/
autoreconf -vif cp %{SOURCE2} subprojects/packagefiles/
%configure \
%ifarch %{arm} aarch64
--enable-neon=no \
%endif
--disable-silent-rules \
--disable-static
%make_build
%build
%meson
%meson_build \
#%%ifarch %%{arm} aarch64
# -Dneon=no \
#%endif
%install %install
%make_install %meson_install
# remove libtool archives
find %{buildroot} -type f -name "*.la" -delete
%ldconfig_scriptlets %ldconfig_scriptlets
%files %files
%doc NEWS AUTHORS README.md %doc NEWS AUTHORS README.md
%license COPYING %license COPYING
%{_libdir}/libwebrtc_audio_processing.so.1* %{_libdir}/libwebrtc-audio-coding-1.so.3*
%{_libdir}/libwebrtc-audio-processing-1.so.3*
%files devel %files devel
%{_libdir}/libwebrtc_audio_processing.so %{_libdir}/libwebrtc-audio-coding-1.so
%{_libdir}/pkgconfig/webrtc-audio-processing.pc %{_libdir}/libwebrtc-audio-processing-1.so
%{_includedir}/webrtc_audio_processing/ %{_libdir}/pkgconfig/webrtc-audio-coding-1.pc
%{_libdir}/pkgconfig/webrtc-audio-processing-1.pc
%{_includedir}/webrtc-audio-processing-1/
%{_includedir}/absl/
%changelog %changelog
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.3.1-8 * Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.3-5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - Bump release for October 2024 mass rebuild:
Related: rhbz#1991688 Resolves: RHEL-64018
* Mon Jul 15 2024 Wim Taymans <wtaymans@redhat.com> - 1.3-4
- Install abseil-cpp headers as well
- Resolves: RHEL-28928
* Fri Jul 12 2024 Wim Taymans <wtaymans@redhat.com> - 1.3-3
- Build abseil-cpp from tarbal
- Resolves: RHEL-28928
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.3-2
- Bump release for June 2024 mass rebuild
* Fri Feb 09 2024 Gwyn Ciesla <gwync@protonmail.com> - 1.3-1
- 1.3
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.3.1-7 * Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-7
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-6 * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

Loading…
Cancel
Save