plugins
plugins copied to clipboard
[flutter_webrtc] Crash when trying to add empty IceCandidate
During the negotiation process, using a secure web socket for signaling, we receive an empty candidate representing the end of remote candidates, but as soon as we try to do peerConnection.addIceCandidate(RTCIceCandidate("")) the application crashes on all Tizen platforms tested.
We tried to use various combinations of old and new plugin versions, including but not limited to:
- flutter_webrtc: 0.9.28 & flutter_webrtc_tizen: 0.1.2
- flutter_webrtc: 0.9.23 & flutter_webrtc_tizen: 0.1.1
- flutter_webrtc: 0.9.18 & flutter_webrtc_tizen: 0.1.0
We started testing on TizenTV as that is our main goal right now, but due to limited logging on it, we switched to TizenMobile as that platform offers a more robust logging system. Even then the logs didn't show anything substantial so I came here to try and get some help as to what may be happening.
The tizen-manifest is as follows:
> <?xml version="1.0" encoding="utf-8"?>
> <manifest package="com.example.example" version="1.0.0" api-version="6.0" xmlns="http://tizen.org/ns/packages">
> <profile name="common"/>
> <ui-application appid="com.example.example" exec="Runner.dll" type="dotnet" multiple="false" nodisplay="false" taskmanage="true">
> <label>example</label>
> <icon>ic_launcher.png</icon>
> <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true"/>
> </ui-application>
> <privileges>
> <privilege>http://tizen.org/privilege/camera</privilege>
> <privilege>http://tizen.org/privilege/internet</privilege>
> <privilege>http://tizen.org/privilege/recorder</privilege>
> </privileges>
> <feature name="http://tizen.org/feature/screen.size.all"/>
> </manifest>
Is there a better way to debug this issue than using the TizenStudio logs or the CrashDump generated and stored on the device?
I commit a patch to solve crash issue of empty IceCandidate. Please refer to https://github.com/flutter-tizen/plugins/pull/625 flutter-webrtc will use libwebrtc(https://github.com/webrtc-sdk/libwebrtc), and we use version 104 of libwebrtc on tizen platform.
@swift-kim is there better way to debug on release image?
@xuelian-bai I have no idea except for replacing dlog_print with printf in log.h (https://github.com/flutter-tizen/plugins/issues/619#issuecomment-1718691151).
I have updated libwebrtc with m114 version of webrtc sdk(https://github.com/webrtc-sdk/webrtc) on Tizen platform (https://github.com/flutter-tizen/plugins/pull/625).
I also tested the empty IceCandidate for 'addIceCandidate' api with debug libwebrtc. There is an error if candidate is empty
01-01 09:06:56.653+0900 I/ConsoleMessage(P10798, T10845): flutter: Received data: {"type":"candidate","data":{"to":"606143","from":"842756","candidate":{"sdpMLineIndex":0,"sdpMid":"0","candidate":""},"session_id":"842756-606143"}}
01-01 09:06:56.653+0900 I/TizenWebRTC(P10798, T10884): (webrtc_sdp.cc:424): Failed to parse: "". Reason: Expect line: candidate:<candidate-str>
webrtc sdk can't parse empty candidate.
I tested flutter_webrtc_demo with the empty candidate is ignored in flutter_webrtc plugin, he connection between peers is successfull.
The flutter_webrtc_demo can send empty candidate after below patch applied.
diff --git a/packages/flutter_webrtc/example/flutter_webrtc_demo/lib/src/call_sample/signaling.dart b/packages/flutter_webrtc/example/flutter_webrtc_demo/lib/src/call_sample/signaling.dart
index fc3fdb1..2227ec4 100644
--- a/packages/flutter_webrtc/example/flutter_webrtc_demo/lib/src/call_sample/signaling.dart
+++ b/packages/flutter_webrtc/example/flutter_webrtc_demo/lib/src/call_sample/signaling.dart
@@ -483,6 +483,24 @@ class Signaling {
}));
};
+ pc.onIceGatheringState = (state) async {
+ print("onIceGatheringState: " + state.toString());
+ if (state == RTCIceGatheringState.RTCIceGatheringStateComplete) {
+ await Future.delayed(
+ const Duration(seconds: 1),
+ () => _send('candidate', {
+ 'to': peerId,
+ 'from': _selfId,
+ 'candidate': {
+ 'sdpMLineIndex': 0,
+ 'sdpMid': '0',
+ 'candidate': '',
+ },
+ 'session_id': sessionId,
+ }));
+ }
+ };
+
pc.onIceConnectionState = (state) {};
The addIceCandidate method provides a remote candidate to the ICE Agent. This method can also be used to indicate the end of remote candidates when called with an empty string for the candidate member.
It maybe have no effect on peer connection even empty IceCandidate ignored. Please refer to sample
If there is peer connection failed because of empty candidate, please share the test app to me.
@Vasques1995 We have fix IceCandidate issue, please apply latest flutter_webrtc_tizen version:
dependencies:
flutter_webrtc: ^0.9.46
flutter_webrtc_tizen: ^0.1.3