Skip to content

feat(m144 upgrade): patch from m137_release (#173)#217

Open
cloudwebrtc wants to merge 49 commits intom144_releasefrom
duan/m144-patching
Open

feat(m144 upgrade): patch from m137_release (#173)#217
cloudwebrtc wants to merge 49 commits intom144_releasefrom
duan/m144-patching

Conversation

@cloudwebrtc
Copy link
Member

No description provided.

@cloudwebrtc cloudwebrtc changed the title feat: patch from m137_release (#173) feat(m144 upgrade): patch from m137_release (#173) Jan 29, 2026
cloudwebrtc and others added 10 commits January 30, 2026 19:59
fixed VP9/AV1 encoder unusable.

We have to apply this patch and publish new binary packages. Otherwise
we can't use AV1/VP9 codec in Apple platform.
Co-authored-by: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com>
Co-authored-by: Harsh Shandilya <122249239+harshs-dyte@users.noreply.github.com>
Remote audio goes through AudioProcessingModule now so it's possible to
get the buffer.
Avoids crash at transceiver deinit that channel is not cleaned up.

---------

Co-authored-by: Błażej Pankowski <86720177+pblazej@users.noreply.github.com>
TODO:
- [x] Core Implementation
- [x] Android JNI Wrapper
- [x] Objective-C Wrapper

---------

Co-authored-by: davidliu <davidliu@deviange.net>
cloudwebrtc and others added 17 commits February 2, 2026 13:27
Adds a flag to override engine start/stop behavior, useful in scenarios
such as CallKit, where the timing for starting AVAudioSession and
AVAudioEngine is restricted.
Fixes crash when toggling audio rendering mode at run-time.
Check recording perm & AVAudioSession.category when enabling input for
device rendering mode to avoid crashes.
… setup to prevent WebRTC deadlocks (#197)

## Description
This PR makes two small but important changes to improve thread safety
and reduce deadlock risk in the iOS bindings:

### 1. RTCAudioTrack.mm

- Remove the explicit [self removeAllRenderers].
- Instead, iterate _adapters and remove each sink from the native audio
track without switching threads, aligning the behavior with
RTCVideoTrack.mm.
- This simplifies teardown and avoids extra synchronization points.

### 2.RTCFrameCryptor.mm

- Remove factory.signalingThread->BlockingCall around
nativeRtpReceiver->SetDepacketizerToDecoderFrameTransformer(...).
- The native call path already runs on the worker thread, so performing
a BlockingCall from the signaling thread introduces an unnecessary
signaling → worker hop that can increase deadlock risk in tight
teardown/configuration sequences.

## Problem Solved

- Redundant signaling → worker thread switching during audio renderer
cleanup and frame-cryptor configuration could contribute to deadlocks
under timing-sensitive conditions (e.g., track teardown overlapping with
transformer setup).
- By eliminating that extra hop, we reduce contention between signaling
and worker threads without changing observable behavior.

## Impact

- Lower likelihood of hangs/deadlocks on teardown/configuration paths.
- Implementation now matches RTCVideoTrack.mm for audio cleanup.
- No public API changes.

---------

Co-authored-by: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com>
…oid (#205)

These default values got changed from true to false in #178. On Android,
the way the audio options are set is fairly janky, and actually relied
on these initially defaulting to true.

I'm not sure if other non iOS platforms rely on these initial default
values as well, but that's something to be aware of for those platforms.
Set automaticallyConfiguresApplicationAudioSession to false just in
case.
* Use enums for ducking level
* Change default ducking level settings
@pblazej
Copy link
Contributor

pblazej commented Feb 11, 2026

🍏


static webrtc::Environment CreateDefaultEnvironment() {
return webrtc::CreateEnvironment(
std::make_unique<webrtc::FieldTrials>("WebRTC-IceHandshakeDtls/Enabled/"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's no way to pass it on Apple vs Kotlin RTCModule.kt via PeerConnectionFactory.Builder.setFieldTrials(), maybe we should invent one to avoid hardcoding?

cc @davidliu

@pblazej
Copy link
Contributor

pblazej commented Feb 13, 2026

🍏

AV1 encoder is failing:

(libaom_av1_encoder.cc:985): LibaomAv1Encoder::Encode returned error: 'Invalid parameter'.

The hypothesis is dimensions mismatch, but I could not reproduce that with VP (same cases):

AV1 is the only codec that wraps its image at the buffer's dimensions instead of the config's dimensions.

Logs:

(libaom_av1_encoder.cc:1040): aom_codec_encode failed: Invalid parameterImage size must match encoder init configuration size img=1280x720 cfg=640x360 pts=2225161 dur=3000
(libaom_av1_encoder.cc:985): LibaomAv1Encoder::Encode returned error: 'Invalid parameter'.
(video_stream_encoder.cc:2225): Failed to encode frame. Error code: -1

Upstream commit:
9eca82b ("Pass lower resolution image to libaom av1 encoder")

@pblazej
Copy link
Contributor

pblazej commented Feb 18, 2026

🍏

  • @hiroshihorie attaching the airpods-crash.log that's probably related to VP (aggregate device) and may be related to the above issue ⬆️ I tried to mitigate the exception here, but that's just a symptom. I did not manage to reproduce it tho (sleeps?)
  • @cloudwebrtc I did two (suboptimal) changes to fix the av1 resolution, wondering if there's a better idea (upstream bug?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments