FreeBSD Bugzilla – Attachment 199245 Details for
Bug 233231
fix build of audio/webrtc-audio-processing on powerpc64
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
new patchfile #1
patch-webrtc_common__audio_wav__file.cc (text/plain), 1.73 KB, created by
Mark Linimon
on 2018-11-14 21:21:12 UTC
(
hide
)
Description:
new patchfile #1
Filename:
MIME Type:
Creator:
Mark Linimon
Created:
2018-11-14 21:21:12 UTC
Size:
1.73 KB
patch
obsolete
>--- 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 > 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() ||
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 233231
: 199245 |
199246
|
199247