Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用 snapshotVideo 导致应用奔溃 #65

Open
Gavin0x0 opened this issue Mar 17, 2023 · 4 comments
Open

调用 snapshotVideo 导致应用奔溃 #65

Gavin0x0 opened this issue Mar 17, 2023 · 4 comments

Comments

@Gavin0x0
Copy link

【当前现象】:持续调用 snapshotVideo 到第 23s iOS应用会奔溃
【SDK版本】:tencent_trtc_cloud-2.4.1
【iOS版本】:iOS 15.2
【设备型号】:iPhone X
【是否必现】:必现
【复现步骤】:
在 iOS 15.2 上的 iPhone X 设备上运行应用
调用 snapshotVideo 方法,并设置 isRecording 为 true
在持续调用 snapshotVideo 方法的过程中,平均每秒截取16张图,应用会在第 23s 崩溃
【期望结果】:应用能够正常运行
【代码】:

while (isRecording) {
      await Future.delayed(const Duration(milliseconds: captureInterval));
      String suffix = DateTime.now().millisecondsSinceEpoch.toString();
      String filePath = "$recordStoragePath/${suffix}_temp.jpg";
      await client.snapshotVideo(
        trtcChannel.isLocal ? null : channel.member.userId,
        0,
        filePath,
      );
}

【异常信息】:

[XPC] Handle connection with error: Connection interrupted
[Process] 0x13a944000 - NetworkProcessProxy::didClose (Network Process 8461 crash)
[ServicesDaemonManager] interruptionHandler is called. -[FontServicesDaemonManager connection]_block_invoke
* thread #72, queue = 'com.Metal.CommandQueueDispatch', stop reason = EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=1850 MB, unused=0x0)
    frame #0: 0x00000001bd1d4b10 libsystem_kernel.dylib`mach_msg_trap + 8
libsystem_kernel.dylib`mach_msg_trap:
->  0x1bd1d4b10 <+8>: ret
libsystem_kernel.dylib`mach_msg_overwrite_trap:
    0x1bd1d4b14 <+0>: mov    x16, #-0x20
    0x1bd1d4b18 <+4>: svc    #0x80
    0x1bd1d4b1c <+8>: ret
Target 0: (Runner) stopped.
Lost connection to device.
@Gavin0x0
Copy link
Author

【补充】:测试了 tencent_trtc_cloud-2.4.5 也存在同样的问题

@c1avie
Copy link
Collaborator

c1avie commented Apr 14, 2023

是不是截图太频繁了,降低频率试试呢,我们也测试下

@Gavin0x0
Copy link
Author

是不是截图太频繁了,降低频率试试呢,我们也测试下

降低频率也会出现,调用 snapshotVideo 到达一定的次数就会崩溃

@Gavin0x0
Copy link
Author

2023-11-22 补充更新:
使用本仓库最新 Demo 又做了次测试
【SDK版本】:tencent_trtc_cloud-2.6.0
【iOS版本】:iOS 15.2
【设备型号】:iPhone X
【是否必现】:必现
【复现步骤】:

  1. 打开本仓库下的 TRTC-Simple-Demo
  2. 更新 test_api.dart 如下
    test_api.dart 代码段
  3. A、B用户进入同一房间,A 用户点击 “api test” 列表下的 “start snapshotVideo-ios“ 按钮开始进行截图
  4. 程序每秒大约截图18次,观察进度,当截图总次数达到 380-420 左右时,程序奔溃

【错误日志】

thread #1, queue = 'com.apple.main-thread', stop reason = EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=1850 MB)

【期望结果】
可以以 18fps 的帧率持续截 1000+ 画面,且多次调用不会累计错误引发奔溃

【对照测试】

  1. 降低截图频率,每秒截图一次,截图总次数达到 380-420 左右时,程序也会奔溃,推测奔溃与截图频率无关
  2. 对 Android 设备使用相同代码进行了测试,测试表现正常,文件管理器中查看截图文件正常,持续截图次数可以到 3000+,不会造成程序异常

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

No branches or pull requests

2 participants