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

Error when calling stoping the recording #24

Open
leonjensen opened this issue Sep 13, 2023 · 7 comments
Open

Error when calling stoping the recording #24

leonjensen opened this issue Sep 13, 2023 · 7 comments

Comments

@leonjensen
Copy link

//Need help//
Every time im stopping the recording i get the error: write() failed. Data transfer aborted (broken pipe)

Im using a new flutter project with just this package and both the start and the stop method inside as well as the listener and onError.
The start method is being called like this:

await plugin.start(
listener,
onError,
sampleRate: 16000,
);

@ysak-y
Copy link
Owner

ysak-y commented Sep 17, 2023

@leonjensen Hi, could you please share the error log more? And could you please share the platform information? (iOS? Andriond? and its version)

@leonjensen
Copy link
Author

Sure, im using Ubuntu as OS and this is my output:


Starting recording sr=16000, bs=5000
[ERROR:flutter/shell/common/shell.cc(1004)] The 'ymd.dev/audio_capture_event_channel' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.
write() fehlgeschlagen: Datenübergabe unterbrochen (broken pipe)

The audio itself still works, just thought i might share this, since i couldn't figure out how to get rid of the error.

@ysak-y
Copy link
Owner

ysak-y commented Sep 18, 2023

Well... do you use this library for making Ubuntu (Linux) application? I'm sorry, I can't support it because I don't implement it. @iceychris did on #9 .

@synchronisator
Copy link

I got the same message, when i start the recording. I am on Linux Mint 20

Starting recording sr=44100, bs=3000
[ERROR:flutter/shell/common/shell.cc(1004)] The 'ymd.dev/audio_capture_event_channel' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.

@synchronisator
Copy link

Android does not work either:

D/AudioCaptureStream(19612): onListen started
E/IAudioFlinger(19612): createRecord returned error -22
E/AudioRecord(19612): AudioFlinger could not create record track, status: -22
E/AudioRecord-JNI(19612): Error creating AudioRecord instance: initialization check failed with status -22.
E/android.media.AudioRecord(19612): Error code -20 when initializing native AudioRecord object.
E/AndroidRuntime(19612): FATAL EXCEPTION: Thread-8
E/AndroidRuntime(19612): Process: de.synchrondev.JCHPlayer, PID: 19612
E/AndroidRuntime(19612): java.lang.UnsupportedOperationException: Cannot create AudioRecord
E/AndroidRuntime(19612): 	at android.media.AudioRecord$Builder.build(AudioRecord.java:635)
E/AndroidRuntime(19612): 	at com.ymd.flutter_audio_capture.AudioCaptureStreamHandler.record(AudioCaptureStreamHandler.kt:122)
E/AndroidRuntime(19612): 	at com.ymd.flutter_audio_capture.AudioCaptureStreamHandler.access$record(AudioCaptureStreamHandler.kt:14)
E/AndroidRuntime(19612): 	at com.ymd.flutter_audio_capture.AudioCaptureStreamHandler$startRecording$runnableObj$1.run(AudioCaptureStreamHandler.kt:57)
E/AndroidRuntime(19612): 	at java.lang.Thread.run(Thread.java:764)
I/Process (19612): Sending signal. PID: 19612 SIG: 9

So maybe here is something bigger broken...

@iceychris
Copy link
Contributor

Probably the way of sharing data between Flutter and plugins or native code changed since I've implemented the Linux part, like the error message above says.

Worth looking into fixing the code to use a Platform Thread for passing data around I guess: https://docs.flutter.dev/platform-integration/platform-channels

@ysak-y
Copy link
Owner

ysak-y commented Nov 19, 2023

@synchronisator I published new issue for Android bug, please provide more information to there.
#25

And I'm really sorry, because I don't have proper Linux environment, I can't solve this bug now...

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

4 participants