Skip to content

Commit a19168b

Browse files
Merge pull request #7 from secondlife/roxie/secondlife-debug-merge
Merge secondlife-debug fixes into non-debug
2 parents d5d4352 + cd42b81 commit a19168b

File tree

7 files changed

+192
-22
lines changed

7 files changed

+192
-22
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ jobs:
5454
# - macos_arm64
5555
- macos_x86_64
5656
# - ios
57-
runs-on: macos-11
57+
runs-on: macos-12
5858
steps:
5959
- uses: actions/checkout@v4
60-
- name: Select Xcode 13.0
61-
run: sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer
60+
- name: Select Xcode 14.0.1
61+
run: sudo xcode-select --switch /Applications/Xcode_14.0.1.app/Contents/Developer
6262
- run: brew install ninja
6363
- run: ./build.${{ matrix.name }}.sh "${{ github.event.inputs.commitHash }}"
6464
- name: Upload Artifact

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ jobs:
6262
# - macos_arm64
6363
- macos_x86_64
6464
# - ios
65-
runs-on: macos-11
65+
runs-on: macos-12
6666
outputs:
6767
output-artifact-id: ${{ steps.artifact-upload-step.outputs.artifact-id }}
6868
steps:
6969
- uses: actions/checkout@v4
70-
- name: Select Xcode 13.0
71-
run: sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer
70+
- name: Select Xcode 14.0.1
71+
run: sudo xcode-select --switch /Applications/Xcode_14.0.1.app/Contents/Developer
7272
- run: brew install ninja
7373
- name: Determine Release Tag
7474
env:
@@ -133,7 +133,7 @@ jobs:
133133
package-macos:
134134
needs:
135135
- build-macos
136-
runs-on: macos-11
136+
runs-on: macos-12
137137
steps:
138138
- uses: secondlife/action-autobuild@v3
139139
with:

build/patches/airpod_fixes.patch

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
diff --git a/modules/audio_device/mac/audio_device_mac.cc b/modules/audio_device/mac/audio_device_mac.cc
2+
index 0a371737b3..eb6061a5d9 100644
3+
--- a/modules/audio_device/mac/audio_device_mac.cc
4+
+++ b/modules/audio_device/mac/audio_device_mac.cc
5+
@@ -1043,13 +1043,6 @@ int32_t AudioDeviceMac::InitPlayout() {
6+
RTC_LOG(LS_VERBOSE) << "mFormatFlags = " << _outStreamFormat.mFormatFlags;
7+
logCAMsg(rtc::LS_VERBOSE, "mFormatID",
8+
(const char*)&_outStreamFormat.mFormatID);
9+
-
10+
- // Our preferred format to work with.
11+
- if (_outStreamFormat.mChannelsPerFrame < 2) {
12+
- // Disable stereo playout when we only have one channel on the device.
13+
- _playChannels = 1;
14+
- RTC_LOG(LS_VERBOSE) << "Stereo playout unavailable on this device";
15+
- }
16+
WEBRTC_CA_RETURN_ON_ERR(SetDesiredPlayoutFormat());
17+
18+
// Listen for format changes.
19+
@@ -1790,12 +1783,19 @@ int32_t AudioDeviceMac::InitDevice(const uint16_t userDeviceIndex,
20+
OSStatus AudioDeviceMac::SetDesiredPlayoutFormat() {
21+
// Our preferred format to work with.
22+
_outDesiredFormat.mSampleRate = N_PLAY_SAMPLES_PER_SEC;
23+
- _outDesiredFormat.mChannelsPerFrame = _playChannels;
24+
+ _outDesiredFormat.mChannelsPerFrame = _outStreamFormat.mChannelsPerFrame;
25+
+ if (_playChannels > 1 && _outDesiredFormat.mChannelsPerFrame < 2) {
26+
+ RTC_LOG(LS_VERBOSE) << "Stereo playout unavailable on this device";
27+
+ }
28+
+ if (_outDesiredFormat.mChannelsPerFrame > _playChannels)
29+
+ {
30+
+ _outDesiredFormat.mChannelsPerFrame = _playChannels;
31+
+ }
32+
33+
if (_ptrAudioBuffer) {
34+
// Update audio buffer with the selected parameters.
35+
_ptrAudioBuffer->SetPlayoutSampleRate(N_PLAY_SAMPLES_PER_SEC);
36+
- _ptrAudioBuffer->SetPlayoutChannels((uint8_t)_playChannels);
37+
+ _ptrAudioBuffer->SetPlayoutChannels((uint8_t)_outDesiredFormat.mChannelsPerFrame);
38+
}
39+
40+
_renderDelayOffsetSamples =
41+
@@ -2096,12 +2096,6 @@ int32_t AudioDeviceMac::HandleStreamFormatChange(
42+
return -1;
43+
}
44+
45+
- if (_ptrAudioBuffer && streamFormat.mChannelsPerFrame != _recChannels) {
46+
- RTC_LOG(LS_ERROR) << "Changing channels not supported (mChannelsPerFrame = "
47+
- << streamFormat.mChannelsPerFrame << ")";
48+
- return -1;
49+
- }
50+
-
51+
RTC_LOG(LS_VERBOSE) << "Stream format:";
52+
RTC_LOG(LS_VERBOSE) << "mSampleRate = " << streamFormat.mSampleRate
53+
<< ", mChannelsPerFrame = "
54+
@@ -2115,6 +2109,12 @@ int32_t AudioDeviceMac::HandleStreamFormatChange(
55+
logCAMsg(rtc::LS_VERBOSE, "mFormatID", (const char*)&streamFormat.mFormatID);
56+
57+
if (propertyAddress.mScope == kAudioDevicePropertyScopeInput) {
58+
+ if (_ptrAudioBuffer && streamFormat.mChannelsPerFrame != _recChannels) {
59+
+ RTC_LOG(LS_ERROR) << "Changing channels not supported (mChannelsPerFrame = "
60+
+ << streamFormat.mChannelsPerFrame << ")";
61+
+ return -1;
62+
+ }
63+
+
64+
const int io_block_size_samples = streamFormat.mChannelsPerFrame *
65+
streamFormat.mSampleRate / 100 *
66+
N_BLOCKS_IO;
67+
@@ -2144,12 +2144,6 @@ int32_t AudioDeviceMac::HandleStreamFormatChange(
68+
&_captureConverter));
69+
} else {
70+
memcpy(&_outStreamFormat, &streamFormat, sizeof(streamFormat));
71+
-
72+
- // Our preferred format to work with
73+
- if (_outStreamFormat.mChannelsPerFrame < 2) {
74+
- _playChannels = 1;
75+
- RTC_LOG(LS_VERBOSE) << "Stereo playout unavailable on this device";
76+
- }
77+
WEBRTC_CA_RETURN_ON_ERR(SetDesiredPlayoutFormat());
78+
}
79+
return 0;
80+
@@ -2262,7 +2256,7 @@ OSStatus AudioDeviceMac::implDeviceIOProc(const AudioBufferList* inputData,
81+
if (_twoDevices || (!_recording && !_playing)) {
82+
// In the case of a shared device, the single driving ioProc
83+
// is stopped here
84+
- WEBRTC_CA_LOG_ERR(AudioDeviceStop(_outputDeviceID, _deviceIOProcID));
85+
+ WEBRTC_CA_LOG_WARN(AudioDeviceStop(_outputDeviceID, _deviceIOProcID));
86+
WEBRTC_CA_LOG_WARN(
87+
AudioDeviceDestroyIOProcID(_outputDeviceID, _deviceIOProcID));
88+
if (err == noErr) {
89+
@@ -2353,7 +2347,7 @@ OSStatus AudioDeviceMac::implInDeviceIOProc(const AudioBufferList* inputData,
90+
MutexLock lock(&mutex_);
91+
if (_doStopRec) {
92+
// This will be signalled only when a shared device is not in use.
93+
- WEBRTC_CA_LOG_ERR(AudioDeviceStop(_inputDeviceID, _inDeviceIOProcID));
94+
+ WEBRTC_CA_LOG_WARN(AudioDeviceStop(_inputDeviceID, _inDeviceIOProcID));
95+
WEBRTC_CA_LOG_WARN(
96+
AudioDeviceDestroyIOProcID(_inputDeviceID, _inDeviceIOProcID));
97+
if (err == noErr) {
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
diff --git a/rtc_base/checks.cc b/rtc_base/checks.cc
2+
index e732a2659d..606dd76bfe 100644
3+
--- a/rtc_base/checks.cc
4+
+++ b/rtc_base/checks.cc
5+
@@ -16,6 +16,7 @@
6+
#include <cstdlib>
7+
8+
#include "absl/strings/string_view.h"
9+
+#include "logging.h"
10+
11+
#if defined(WEBRTC_ANDROID)
12+
#define RTC_LOG_TAG_ANDROID "rtc"
13+
@@ -24,6 +25,8 @@
14+
15+
#if defined(WEBRTC_WIN)
16+
#include <windows.h>
17+
+#else
18+
+#include <unistd.h>
19+
#endif
20+
21+
#if defined(WEBRTC_WIN)
22+
@@ -64,18 +67,33 @@ namespace webrtc_checks_impl {
23+
24+
#if !defined(WEBRTC_CHROMIUM_BUILD)
25+
RTC_NORETURN void WriteFatalLog(absl::string_view output) {
26+
-#if defined(WEBRTC_ANDROID)
27+
std::string output_str(output);
28+
+#if defined(WEBRTC_ANDROID)
29+
__android_log_print(ANDROID_LOG_ERROR, RTC_LOG_TAG_ANDROID, "%s\n",
30+
output_str.c_str());
31+
#endif
32+
+ // write to stdout so that it ends up in the logs.
33+
+ fwrite(output.data(), output.size(), 1, stdout);
34+
fflush(stdout);
35+
fwrite(output.data(), output.size(), 1, stderr);
36+
fflush(stderr);
37+
+ // attempt to notify the logging subsystem to broadcast to the sinks.
38+
+ RTC_LOG(LS_ERROR) << output_str << "\n";
39+
#if defined(WEBRTC_WIN)
40+
- DebugBreak();
41+
+// DebugBreak();
42+
#endif
43+
- abort();
44+
+ // force a crash so that the crash logger can capture the exception.
45+
+ long* null_ptr;
46+
+ null_ptr = 0;
47+
+ *null_ptr = 0xDEADBEEF;
48+
+ while (true)
49+
+ {
50+
+#if defined(WEBRTC_WIN)
51+
+ _sleep(1);
52+
+#else
53+
+ usleep(1);
54+
+#endif
55+
+ }
56+
}
57+
58+
RTC_NORETURN void WriteFatalLog(const char* file,
Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
From 82a4fa0b2e4b6cc37a7c4dbb37d705f78405c187 Mon Sep 17 00:00:00 2001
2-
From: Roxie Linden <[email protected]>
3-
Date: Mon, 8 Jan 2024 20:09:24 -0800
4-
Subject: [PATCH] upsample to 48khz for echo cancellation (for now)
5-
6-
---
7-
audio/audio_transport_impl.cc | 4 +++-
8-
1 file changed, 3 insertions(+), 1 deletion(-)
9-
101
diff --git a/audio/audio_transport_impl.cc b/audio/audio_transport_impl.cc
11-
index 42a81d5b4a..24de07d613 100644
2+
index 42a81d5b4a..18d09aedc5 100644
123
--- a/audio/audio_transport_impl.cc
134
+++ b/audio/audio_transport_impl.cc
145
@@ -36,7 +36,9 @@ void InitializeCaptureFrame(int input_sample_rate,
@@ -22,6 +13,12 @@ index 42a81d5b4a..24de07d613 100644
2213
for (int native_rate_hz : AudioProcessing::kNativeSampleRatesHz) {
2314
audio_frame->sample_rate_hz_ = native_rate_hz;
2415
if (audio_frame->sample_rate_hz_ >= min_processing_rate_hz) {
25-
--
26-
2.43.0.windows.1
27-
16+
@@ -139,7 +141,7 @@ int32_t AudioTransportImpl::RecordedDataIsAvailable(
17+
estimated_capture_time_ns) { // NOLINT: to avoid changing APIs
18+
RTC_DCHECK(audio_data);
19+
RTC_DCHECK_GE(number_of_channels, 1);
20+
- RTC_DCHECK_LE(number_of_channels, 2);
21+
+ RTC_DCHECK_LE(number_of_channels, 8); // allow up to 8 input channels, which will be remixed as appropriate
22+
RTC_DCHECK_EQ(2 * number_of_channels, bytes_per_sample);
23+
RTC_DCHECK_GE(sample_rate, AudioProcessing::NativeRate::kSampleRate8kHz);
24+
// 100 = 1 second / data duration (10 ms).

build/run.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def get_depot_tools(source_dir, fetch=False):
187187
'bug_8759_workaround.patch',
188188
'msvc-checks-template.patch',
189189
'disable_mute_of_audio_processing.patch',
190+
'crash_on_fatal_error.patch',
190191
],
191192
'windows_x86': [
192193
'add_license_dav1d.patch',
@@ -198,6 +199,7 @@ def get_depot_tools(source_dir, fetch=False):
198199
'bug_8759_workaround.patch',
199200
'msvc-checks-template.patch',
200201
'disable_mute_of_audio_processing.patch',
202+
'crash_on_fatal_error.patch',
201203
],
202204
'windows_arm64': [
203205
'add_license_dav1d.patch',
@@ -209,6 +211,7 @@ def get_depot_tools(source_dir, fetch=False):
209211
'bug_8759_workaround.patch',
210212
'msvc-checks-template.patch'
211213
'disable_mute_of_audio_processing.patch',
214+
'crash_on_fatal_error.patch',
212215
],
213216
'macos_x86_64': [
214217
'add_license_dav1d.patch',
@@ -217,6 +220,8 @@ def get_depot_tools(source_dir, fetch=False):
217220
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
218221
'bug_8759_workaround.patch',
219222
'disable_mute_of_audio_processing.patch',
223+
'crash_on_fatal_error.patch',
224+
'airpod_fixes.patch',
220225
],
221226
'macos_arm64': [
222227
'add_license_dav1d.patch',
@@ -225,6 +230,8 @@ def get_depot_tools(source_dir, fetch=False):
225230
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
226231
'bug_8759_workaround.patch',
227232
'disable_mute_of_audio_processing.patch',
233+
'crash_on_fatal_error.patch',
234+
'airpod_fixes.patch',
228235
],
229236
'ios': [
230237
'add_license_dav1d.patch',
@@ -233,6 +240,7 @@ def get_depot_tools(source_dir, fetch=False):
233240
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
234241
'bug_8759_workaround.patch',
235242
'disable_mute_of_audio_processing.patch',
243+
'crash_on_fatal_error.patch',
236244
],
237245
'android': [
238246
'add_license_dav1d.patch',
@@ -241,69 +249,79 @@ def get_depot_tools(source_dir, fetch=False):
241249
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
242250
'bug_8759_workaround.patch',
243251
'disable_mute_of_audio_processing.patch',
252+
'crash_on_fatal_error.patch',
244253
],
245254
'android_prefixed': [
246255
'add_license_dav1d.patch',
247256
'android_webrtc_version.patch',
248257
'fix_mocks.patch',
249258
'jni_prefix.patch',
250259
'disable_mute_of_audio_processing.patch',
260+
'crash_on_fatal_error.patch',
251261
],
252262
'raspberry-pi-os_armv6': [
253263
'add_license_dav1d.patch',
254264
'fix_mocks.patch',
255265
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
256266
'bug_8759_workaround.patch',
257267
'disable_mute_of_audio_processing.patch',
268+
'crash_on_fatal_error.patch',
258269
],
259270
'raspberry-pi-os_armv7': [
260271
'add_license_dav1d.patch',
261272
'fix_mocks.patch',
262273
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
263274
'bug_8759_workaround.patch',
264275
'disable_mute_of_audio_processing.patch',
276+
'crash_on_fatal_error.patch',
265277
],
266278
'raspberry-pi-os_armv8': [
267279
'add_license_dav1d.patch',
268280
'fix_mocks.patch',
269281
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
270282
'bug_8759_workaround.patch',
271283
'disable_mute_of_audio_processing.patch',
284+
'crash_on_fatal_error.patch',
272285
],
273286
'ubuntu-18.04_armv8': [
274287
'add_license_dav1d.patch',
275288
'fix_mocks.patch',
276289
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
277290
'bug_8759_workaround.patch',
278291
'disable_mute_of_audio_processing.patch',
292+
'crash_on_fatal_error.patch',
279293
],
280294
'ubuntu-20.04_armv8': [
281295
'add_license_dav1d.patch',
282296
'fix_mocks.patch',
283297
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
284298
'bug_8759_workaround.patch',
285299
'disable_mute_of_audio_processing.patch',
300+
'crash_on_fatal_error.patch',
286301
],
287302
'ubuntu-18.04_x86_64': [
288303
'add_license_dav1d.patch',
289304
'fix_mocks.patch',
290305
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
291306
'bug_8759_workaround.patch',
292307
'disable_mute_of_audio_processing.patch',
308+
'crash_on_fatal_error.patch',
293309
],
294310
'ubuntu-20.04_x86_64': [
295311
'add_license_dav1d.patch',
296312
'fix_mocks.patch',
297313
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
298314
'bug_8759_workaround.patch',
299315
'disable_mute_of_audio_processing.patch',
316+
'crash_on_fatal_error.patch',
300317
],
301318
'ubuntu-22.04_x86_64': [
302319
'add_license_dav1d.patch',
303320
'fix_mocks.patch',
304321
'upsample-to-48khz-for-echo-cancellation-for-now.patch',
305322
'bug_8759_workaround.patch',
306323
'disable_mute_of_audio_processing.patch',
324+
'crash_on_fatal_error.patch',
307325
],
308326
}
309327

build/ubuntu-20.04_x86_64/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ COPY scripts/ /root/scripts/
1414
COPY $PACKAGE_NAME/ /root/$PACKAGE_NAME/
1515
RUN /root/scripts/apt_install_x86_64.sh
1616
ENV LC_ALL=C.UTF-8
17-
RUN cd /root && python3 run.py build $PACKAGE_NAME --commit "${COMMIT_HASH}"
18-
RUN cd /root && python3 run.py package $PACKAGE_NAME
17+
RUN cd /root && python3 run.py build --debug $PACKAGE_NAME --commit "${COMMIT_HASH}"
18+
RUN cd /root && python3 run.py package --debug $PACKAGE_NAME
1919
RUN mv $PACKAGE_DIR/webrtc.tar.bz2 /
2020

2121
FROM ubuntu:20.04

0 commit comments

Comments
 (0)