diff --git a/flutter/sherpa_onnx/lib/src/offline_speaker_diarization.dart b/flutter/sherpa_onnx/lib/src/offline_speaker_diarization.dart index ff9d34070..5981e3c04 100644 --- a/flutter/sherpa_onnx/lib/src/offline_speaker_diarization.dart +++ b/flutter/sherpa_onnx/lib/src/offline_speaker_diarization.dart @@ -1,5 +1,4 @@ // Copyright (c) 2024 Xiaomi Corporation -import 'dart:convert'; import 'dart:ffi'; import 'dart:typed_data'; @@ -7,7 +6,6 @@ import 'package:ffi/ffi.dart'; import './sherpa_onnx_bindings.dart'; import './speaker_identification.dart'; -import './utils.dart'; class OfflineSpeakerDiarizationSegment { const OfflineSpeakerDiarizationSegment({ @@ -226,7 +224,7 @@ class OfflineSpeakerDiarization { final ans = []; for (int i = 0; i != numSegments; ++i) { - final s = segments.elementAt(i); + final s = segments + i; final tmp = OfflineSpeakerDiarizationSegment( start: s.ref.start, end: s.ref.end, speaker: s.ref.speaker); diff --git a/sherpa-onnx/csrc/offline-speaker-diarization-pyannote-impl.h b/sherpa-onnx/csrc/offline-speaker-diarization-pyannote-impl.h index 8f669e27c..0c70f0bc6 100644 --- a/sherpa-onnx/csrc/offline-speaker-diarization-pyannote-impl.h +++ b/sherpa-onnx/csrc/offline-speaker-diarization-pyannote-impl.h @@ -5,6 +5,7 @@ #define SHERPA_ONNX_CSRC_OFFLINE_SPEAKER_DIARIZATION_PYANNOTE_IMPL_H_ #include +#include #include #include #include diff --git a/sherpa-onnx/jni/offline-speaker-diarization.cc b/sherpa-onnx/jni/offline-speaker-diarization.cc index a0eef8b9c..e82962c80 100644 --- a/sherpa-onnx/jni/offline-speaker-diarization.cc +++ b/sherpa-onnx/jni/offline-speaker-diarization.cc @@ -204,7 +204,8 @@ Java_com_k2fsa_sherpa_onnx_OfflineSpeakerDiarization_processWithCallback( jfloat *p = env->GetFloatArrayElements(samples, nullptr); jsize n = env->GetArrayLength(samples); auto segments = - sd->Process(p, n, callback_wrapper, (void *)arg).SortByStartTime(); + sd->Process(p, n, callback_wrapper, reinterpret_cast(arg)) + .SortByStartTime(); env->ReleaseFloatArrayElements(samples, p, JNI_ABORT); return ProcessImpl(env, segments);