100ms-flutter icon indicating copy to clipboard operation
100ms-flutter copied to clipboard

Initializing HMSSDK with hmsTrackSetting causes crash on IOS.

Open joshmossas opened this issue 1 year ago • 4 comments

Happens in the IOS emulator and running on a 9th generation iPad (running iPadOS 15.7.1) when running in debug or profile mode. No crash occurs on android. I have not tested in release mode yet.

hmssdk_flutter version ^0.7.8

HMS Dependencies in Podfile.lock

- HMSBroadcastExtensionSDK (0.0.4)
  - HMSSDK (0.4.6):
    - HMSWebRTC (= 1.0.4898)
  - hmssdk_flutter (0.7.8):
    - Flutter
    - HMSBroadcastExtensionSDK (= 0.0.4)
    - HMSSDK (= 0.4.6)
  - HMSWebRTC (1.0.4898)

Flutter Doctor

[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0.1 22A400
    darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android
    SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Log Output

Launching lib/main.dart on Joshua’s iPad in profile mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: C89V55G77L
Xcode build done.                                           560.2s
(lldb) 2022-11-15 16:11:52.650677-0600 Runner[20531:1489098] 10.1.0 - [FirebaseCore][I-COR000005] No app has been configured yet.
Connecting to VM Service at ws://127.0.0.1:49504/FLOiVmG5CyQ=/ws
[CoreBluetooth] XPC connection invalid
[connection] nw_socket_handle_socket_event [C3.1:1] Socket SO_ERROR [54: Connection reset by peer]
[CoreBluetooth] XPC connection invalid
Unsupported value: <HMSSimulcastLayerSettings: 0x280b5bf00> of type HMSSimulcastLayerSettings
*** Assertion failure in -[FlutterStandardWriter writeValue:], FlutterStandardCodec.mm:338
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unsupported value for standard codec'
*** First throw call stack:
(0x180b0a288 0x19983e744 0x18239b340 0x106be7684 0x106be7874 0x106be7874 0x106be7dfc 0x106be4e74 0x102aa71ac 0x102aa9a58 0x102a96ac0 0x106be4ddc 0x1066bf44c 0x18076fe6c 0x180771a30 0x18077ff48 0x18077fb98 0x180ac2800 0x180a7c704 0x180a8fbc8 0x19cbff374 0x183405b58 0x183187098 0x102050078 0x102499da4)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001b797db38 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`:
->  0x1b797db38 <+8>:  b.lo   0x1b797db58               ; <+40>
    0x1b797db3c <+12>: pacibsp
    0x1b797db40 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b797db44 <+20>: mov    x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
Exited

joshmossas avatar Nov 15 '22 22:11 joshmossas

Playing around with it more it looks like the following line is causing the issue:

hmssdk = HMSSDK(
  hmsTrackSettings: trackSettings, // this line causes the crash
  hmsLogSettings: logSettings
)

after commenting out that line the crash no longer occurs. So this is an issue with creating the HMSSDK with the hmsTrackSetting on IOS.

joshmossas avatar Nov 15 '22 23:11 joshmossas

Hey, @joshmossas are you using the example app?

govindmaheshwari2 avatar Nov 16 '22 07:11 govindmaheshwari2

No this is happening in our own app. Although we have been referencing the example apps.

joshmossas avatar Nov 16 '22 15:11 joshmossas

In the example app HMSAudioTrackSettings is being initialized with audio source set to a value and HMSVideoTrackSettings is being initialized with forceSoftwareDecoder having a value set as well. In our app we have not defined these values as the dart interface says they can be null. So maybe this bug occurs when one of those values isn't set.

I will check when I get the chance and report back my findings.

joshmossas avatar Nov 16 '22 15:11 joshmossas

hey @joshmossas Hope you were able to resolve the issue. Closing this now.

ygit avatar Dec 14 '22 14:12 ygit

@ygit The fix for this was in https://github.com/100mslive/100ms-flutter/tree/fixedDefaultSimulcastSettings

Has this been added to the latest release?

joshmossas avatar Dec 14 '22 20:12 joshmossas

Yes @joshmossas It is already available in the latest release

ygit avatar Dec 15 '22 08:12 ygit