Open sbesnard opened 1 month ago
Hi @sbesnard I'm aware that the secure coding is not the actual problem.
Instead, this line indicates the exception is coming from AudioIsolate
.
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: Messenger is not attached to an worker.
#0 AudioIsolateHostMessenger.request (package:coast_audio/src/isolate/audio_isolate_messenger.dart:27:7)
#1 AudioIsolate.request (package:coast_audio/src/isolate/audio_isolate.dart:106:23)
#2 PlayerIsolate.getPosition (package:example/isolates/player_isolate.dart:133:21)
#3 _PlayerTileState.build.<anonymous closure> (package:example/components/player_tile.dart:160:50)
#4 _PlayerTimerBuilderState._init.<anonymous closure> (package:example/components/player_tile.dart:267:43)
#5 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#6 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#7 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
Can you attach the wav file when this problem occurs?
@SKKbySSK You're right, I changed the subject of this issue. Sorry !
I just launched VSCode in the example folder of the repo.
The issue happens when I stop the recording.
I can trace the pb to this line in player_tile.dart
:
onTick: (isolate) {
return isolate.getPosition();
},
Which in turn calls ultimately audio_isolate_messenger.dart
:
Future<TResponse?> request<TRequest, TResponse>(TRequest payload) async {
final sendPort = _sendPort;
if (sendPort == null) {
throw StateError('Messenger is not attached to an worker');
}
final request = AudioIsolateHostRequest(payload);
final responseFuture = message.firstWhere((r) => r is AudioIsolateWorkerResponse && r.requestId == request.id);
sendPort.send(request);
final AudioIsolateWorkerResponse response;
try {
response = await responseFuture as AudioIsolateWorkerResponse;
} on StateError {
return null;
}
switch (response) {
case AudioIsolateWorkerSuccessResponse():
if (response.payload is TResponse) {
return response.payload as TResponse;
} else {
throw StateError('Unexpected response type: ${response.payload.runtimeType}');
}
case AudioIsolateWorkerFailedResponse():
return Future.error(response.exception, response.stackTrace);
}
}
Thanks! I am working on another piece of code that may not have this issue.I'll keep you posted.
This issue is stale because it has been open for 30 days with no activity.
Hi,
I ran into this problem on may Mac M1 running vanilla example and trying to play a sample wav.
Any idea ?
Thanks in advance