chenxiaolong / BCR

A Basic Call Recorder for rooted Android devices
GNU General Public License v3.0
1.67k stars 109 forks source link

Getting notification as "Failed to record call" #153

Open CodElixer opened 1 year ago

CodElixer commented 1 year ago

Hi Andrew, It's me again!

Everything is working fine for BCR since then but I'm getting notification sometimes as "Failed to record call". Screenshot Just wanted to let you know, It's happening sometimes. If you need more help in this then please let me know.

Thanks:)

chenxiaolong commented 1 year ago

Interesting! I've never seen it fail with an empty error message before. It's supposed to have an additional line with more details.

Can you enable debug mode (long press the version number in BCR) and upload the log file from the output directory the next time it fails?

CodElixer commented 1 year ago

Sure, I'll keep that setting on and If it appears again will send you the log.

arpitrockk commented 1 year ago

Screenshot_20221026-165943_Phone Having the same error as mentioned above in Android 12 Ricedroid Custom OS, and after call the output file is of 0 bytes. If, you need additional logs please let me know. Btw, thanks for the great app.

chenxiaolong commented 1 year ago

Please enable debug mode (long press the version number in BCR) and upload the log file from the output directory after making a phone call.

arpitrockk commented 1 year ago

Please enable debug mode (long press the version number in BCR) and upload the log file from the output directory after making a phone call.

Enabled the debug mode, but the issue is not persistent. It occurs occassionally, and get's solved via force closing the app or sometimes after restarting the phone. But, I don't know what cause that, will definitely upload the log on the next occurance.

arpitrockk commented 1 year ago

Please enable debug mode (long press the version number in BCR) and upload the log file from the output directory after making a phone call.

20221026_222740.565+0530_in_SomeContact.log.txt

Log for my recent call having the above-mentioned issue.

chenxiaolong commented 1 year ago

Thanks for the logs. The error is coming from Android itself:

10-26 22:27:50.689 10424 28436 E RecorderThread/41: android.media.MediaCodec$CodecException: Error 0xe
10-26 22:27:50.689 10424 28436 E RecorderThread/41:     at android.media.MediaCodec.native_queueInputBuffer(Native Method)
...

Looks like the ROM you're running has a buggy encoder. I'd suggest trying to change the output format to M4A/AAC. If that also fails, you might be stuck using the WAV/PCM output (which does not require encoding).

arpitrockk commented 1 year ago

Thanks for the logs. The error is coming from Android itself:

10-26 22:27:50.689 10424 28436 E RecorderThread/41: android.media.MediaCodec$CodecException: Error 0xe
10-26 22:27:50.689 10424 28436 E RecorderThread/41:   at android.media.MediaCodec.native_queueInputBuffer(Native Method)
...

Looks like the ROM you're running has a buggy encoder. I'd suggest trying to change the output format to M4A/AAC. If that also fails, you might be stuck using the WAV/PCM output (which does not require encoding).

Ohh thank you so much, so that is from ROM side then, actually, I kinda noticed that coz when I changed my output format to FLAC it was not giving me that error. Btw, which would you advice M4A/AAC or FLAC ? Coz, FLAC is giving me good output with almost similar file size with compression level 8.

Update: Tried using FLAC too giving same encoding error. But, I have one query, as to, why it does not gives error after force closing and restarting the app. It records successfully after that but only after sometime it gives that error. And restarting the app makes it work again.

Can these encoders be flashed via some magisk module or something ?

chenxiaolong commented 1 year ago

Update: Tried using FLAC too giving same encoding error.

That's unfortunately. WAV/PCM might be the only option. All of the rest rely on Android's built-in encoders.

But, I have one query, as to, why it does not gives error after force closing and restarting the app. It records successfully after that but only after sometime it gives that error. And restarting the app makes it work again.

When BCR is force closed, it may also trigger Android's encoder process to exit/restart.

Can these encoders be flashed via some magisk module or something ?

On Google Pixels, encoders get updated regularly through Google Play System Updates, but I don't know for other ROMs/devices.

arpitrockk commented 1 year ago

Update: Tried using FLAC too giving same encoding error.

That's unfortunately. WAV/PCM might be the only option. All of the rest rely on Android's built-in encoders.

But, I have one query, as to, why it does not gives error after force closing and restarting the app. It records successfully after that but only after sometime it gives that error. And restarting the app makes it work again.

When BCR is force closed, it may also trigger Android's encoder process to exit/restart.

Can these encoders be flashed via some magisk module or something ?

On Google Pixels, encoders get updated regularly through Google Play System Updates, but I don't know for other ROMs/devices.

Ohh thanks for all the information mate, I have mentioned the same to the ROM's maintainers group, but I don't think they will implement it in Android 12 anymore. So, I think I have to use WAV/PCM format for now. I wanna ask one more thing, is there any way to reduce the file size of this format. Coz, it produces almost 3-4 times the normal file produced by other formats. I know it is coz of the encoding that helps in reducing the file size, but still I am curious, if there are any means. Thanks once again.

chenxiaolong commented 1 year ago

No problem!

It might be worth looking into something like Tasker. Maybe it's possible to set up a task like: when a .wav file is created, run a command and then delete the original file. The command could be an external encoder, like ffmpeg, that would convert from .wav to another format. I've never done this personally, so I'm not sure how well it would work (if it even works).

arpitrockk commented 1 year ago

No problem!

It might be worth looking into something like Tasker. Maybe it's possible to set up a task like: when a .wav file is created, run a command and then delete the original file. The command could be an external encoder, like ffmpeg, that would convert from .wav to another format. I've never done this personally, so I'm not sure how well it would work (if it even works).

Tbh that sounds kinda cumbersome to be executed for every call recording. Instead I will opt for deleting some of them on regular basis so, it will save space and also remove the unused file which I ultimately do even with small files. But, anyway thanks for all the help and keep up this great work.

CodElixer commented 1 year ago

Hi @chenxiaolong Previously I was getting notification as Failed to record calls but now getting these notifications as "Successfully Recorded Call". Any idea?Screenshot_20221226-184836_BCR.png

chenxiaolong commented 1 year ago

Are the audio files actually good or is it reporting success despite things being broken?

(The success notifications were added in version 1.24 and can be disabled from Android's app settings if they are annoying.)