Skip to content

Commit b348da3

Browse files
authored
Fix RtpReceiver use after free on Android platform (#165)
1 parent dc5a0ad commit b348da3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ All user visible changes to this project will be documented in this file. This p
3333
- Unexpected audio category on `setOutputAudioId` call on [iOS]. ([#146])
3434
- Race condition bug on `setOutputAudioId` call on [Android]. ([#146])
3535
- Race condition bug on input/output device switch on desktop platforms. ([#151])
36+
- `RtpReceiver` use after free on [Android]. ([#165])
3637

3738
[#137]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/137
3839
[#139]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/139
@@ -47,6 +48,7 @@ All user visible changes to this project will be documented in this file. This p
4748
[#156]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/156
4849
[#162]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/162
4950
[#164]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/164
51+
[#165]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/165
5052
[`dart:html`]: https://dart.dev/libraries/dart-html
5153
[`package:web`]: https://pub.dev/packages/web
5254
[126.0.6478.182-r2]: https://github.com/instrumentisto/libwebrtc-bin/releases/tag/126.0.6478.182-r2

android/src/main/kotlin/com/instrumentisto/medea_flutter_webrtc/proxy/PeerObserver.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ class PeerObserver : PeerConnection.Observer {
6565
override fun onTrack(transceiver: RtpTransceiver?) {
6666
if (transceiver != null && peer != null) {
6767
if (!peer!!.disposed) {
68+
val receiverId = transceiver.receiver.id()
6869
Handler(Looper.getMainLooper()).post {
69-
val receiver = transceiver.receiver
7070
val transceivers = peer?.getTransceivers()!!
7171
for (trans in transceivers) {
72-
if (trans.receiver.id == receiver.id()) {
72+
if (trans.receiver.id == receiverId) {
7373
peer?.observableEventBroadcaster()?.onTrack(trans.receiver.track, trans)
7474
}
7575
}

0 commit comments

Comments
 (0)