Sav22999 / common-voice-android

Repository of "CV Project" app. It's an unofficial app for Mozilla Common Voice, which permits you to contribute to this project via your device.
https://www.saveriomorelli.com/commonvoice/
GNU General Public License v3.0
108 stars 18 forks source link

[BUG] Cannot start recording #174

Open eppesuig opened 3 years ago

eppesuig commented 3 years ago

General information

About OS*

OS version: LineageOS 18.1 (Android 11)

OS language (in English):_ Italian

About the app (CV Android)*

App release: 2.3.6.5 (build#151::FD-GH)

App language (in English): Italian

About you device

Device RAM: 3GB

Device display size (in Inches): 5.5in

(Optional, but recommended) Device model (and brand): OnePlus 1

From what store have you installed the app?: F-Droid

Are there installed Google Services on your device? Yes

Description bug *

Sometimes, the app does not start recording at all. It happens after the phone is switched on. Some days it works perfectly, some other I have to reboot the phone and try again. When it does not work, I press the record button and the application get back to its main screen; then I press it again and a popup asks me what to do (I usually select to switch off the app). Starting the app again have the same behaviour until I reboot the phone. If I use the app and it works normally, no matter how many times I restart it, it works. Once I switch off the phone, I do not know if it will work again.

How to reproduce the bug *

  1. start the app
  2. press the red button on the bottom left corner of the screen
  3. press the same button on the centre of screen, below the sentence you are supposed to record
  4. the screen goes white for a short time (about 0.5 seconds) and you are back to the main screen
  5. press the red button on the bottom left corner of the screen (again)
  6. press the same button on the centre of screen (again)
  7. a popup appears. Its title is "L'app CV Project continua a interrompersi". The first option is "Informazioni app", the second option is "Chiudi l'app". Select the second one

Screenshots

Log file

java.lang.RuntimeException: start failed.
    at android.media.MediaRecorder.start(Native Method)
    at org.commonvoice.saverio_lib.mediaRecorder.MediaRecorderRepository.startRecording(MediaRecorderRepository.kt:37)
    at org.commonvoice.saverio_lib.viewmodels.SpeakViewModel.startRecording(SpeakViewModel.kt:72)
    at org.commonvoice.saverio.SpeakActivity$setupUIStateStandby$$inlined$withBinding$lambda$1.onClick(Extensions.kt:30)
    at android.view.View.performClick(View.java:7448)
    at android.view.View.performClickInternal(View.java:7425)
    at android.view.View.access$3600(View.java:810)
    at android.view.View$PerformClick.run(View.java:28305)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7660)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

You can find the log file in the Internal storage > Android > data > org.commonvoice.saverio > files > logs > log.txt

Additional context

Oher apps that probably record audio work (e.g. Duolingo, Telegram)

Thank you very much, Giuseppe

Sav22999 commented 3 years ago

Thanks for the reporting. This is very weird 😕 sometimes works sometimes doesn't work.

I'll try to investigate and fix this 😄

eppesuig commented 3 years ago

I have been reading the source code, but do not have any ideas about what is really going wrong. Sorry.

eppesuig commented 3 years ago

This is a more detailed log, got via adb logcat that probably points to the source problem "no default device defined":

06-01 14:13:35.391   699  3994 I ActivityTaskManager: START u0 {cmp=org.commonvoice.saverio/.SpeakActivity} from uid 10172
06-01 14:13:35.406   366   366 I android.hardware.power-service-qti: Power setMode: 5 to: 1
06-01 14:13:35.416   699  3995 W ActivityTaskManager: Tried to set launchTime (0) < mLastActivityLaunchTime (84454)
06-01 14:13:35.471   468  7627 W StagefrightRecorder: Target duration (10000000 us) too short to be respected
06-01 14:13:35.520  7237  7271 W Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:607>: EGL_BAD_ATTRIBUTE
06-01 14:13:35.545   699   747 I ActivityTaskManager: Displayed org.commonvoice.saverio/.SpeakActivity: +153ms
06-01 14:13:35.578   366   366 I android.hardware.power-service-qti: Power setMode: 5 to: 0
06-01 14:13:27.133     0     0 E NOHZ    : local_softirq_pending 100
06-01 14:13:36.660   468   468 W StagefrightRecorder: stop while neither recording nor paused
06-01 14:13:36.661   468  7627 W StagefrightRecorder: stop while neither recording nor paused
06-01 14:13:36.663   468   527 W StagefrightRecorder: stop while neither recording nor paused
06-01 14:13:36.675   468  7627 W StagefrightRecorder: stop while neither recording nor paused
06-01 14:13:36.680   468  7627 W StagefrightRecorder: Target duration (10000000 us) too short to be respected
06-01 14:13:36.681   468   527 D MPEG4Writer: PreAllocation enabled
06-01 14:13:36.682   468   527 W StagefrightRecorder: Intended audio encoding bit rate (705600) is too large and will be set to (320000)
06-01 14:13:36.686   381   381 E APM::AudioPolicyEngine: getDeviceForInputSource() no default device defined
06-01 14:13:36.686   381   381 W APM_AudioPolicyManager: getInputForAttr() could not find device for source 1
06-01 14:13:36.686   381   381 E AudioFlinger: createRecord() getInputForAttr return error -22
06-01 14:13:36.686   468   527 E IAudioFlinger: createRecord returned error -22
06-01 14:13:36.686   468   527 E AudioRecord: createRecord_l(0): AudioFlinger could not create record track, status: -22
06-01 14:13:36.687   468   527 E StagefrightRecorder: audio source is not initialized
06-01 14:13:36.687   468   527 D MPEG4Writer: reset()
06-01 14:13:36.687   468   527 D MPEG4Writer: release()
06-01 14:13:36.687   468   527 D MPEG4Writer: ftruncate mPreAllocateFileEndOffset:0 mOffset:0 mMdatEndOffset:0 diff:0
06-01 14:13:36.692  7237  7237 E MediaRecorder: start failed: -2147483648
06-01 14:13:36.692  7237  7237 D AndroidRuntime: Shutting down VM
06-01 14:13:36.693  7237  7237 E AndroidRuntime: FATAL EXCEPTION: main
06-01 14:13:36.693  7237  7237 E AndroidRuntime: Process: org.commonvoice.saverio, PID: 7237
06-01 14:13:36.693  7237  7237 E AndroidRuntime: java.lang.RuntimeException: start failed.
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at android.media.MediaRecorder.start(Native Method)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at org.commonvoice.saverio_lib.mediaRecorder.MediaRecorderRepository.startRecording(MediaRecorderRepository.kt:37)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at org.commonvoice.saverio_lib.viewmodels.SpeakViewModel.startRecording(SpeakViewModel.kt:72)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at org.commonvoice.saverio.SpeakActivity$setupUIStateStandby$$inlined$withBinding$lambda$1.onClick(Extensions.kt:30)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at android.view.View.performClick(View.java:7448)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at android.view.View.performClickInternal(View.java:7425)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at android.view.View.access$3600(View.java:810)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at android.view.View$PerformClick.run(View.java:28305)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:938)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:99)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:223)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7660)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
06-01 14:13:36.693  7237  7237 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler: java.lang.RuntimeException: start failed.
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at android.media.MediaRecorder.start(Native Method)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at org.commonvoice.saverio_lib.mediaRecorder.MediaRecorderRepository.startRecording(MediaRecorderRepository.kt:37)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at org.commonvoice.saverio_lib.viewmodels.SpeakViewModel.startRecording(SpeakViewModel.kt:72)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at org.commonvoice.saverio.SpeakActivity$setupUIStateStandby$$inlined$withBinding$lambda$1.onClick(Extensions.kt:30)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at android.view.View.performClick(View.java:7448)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at android.view.View.performClickInternal(View.java:7425)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at android.view.View.access$3600(View.java:810)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at android.view.View$PerformClick.run(View.java:28305)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at android.os.Handler.handleCallback(Handler.java:938)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at android.os.Handler.dispatchMessage(Handler.java:99)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at android.os.Looper.loop(Looper.java:223)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at android.app.ActivityThread.main(ActivityThread.java:7660)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at java.lang.reflect.Method.invoke(Native Method)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
06-01 14:13:36.699  7237  7283 E VariableLanguageActivity$setCustomDefaultUncaughtExceptionHandler:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
06-01 14:13:36.714   699  7749 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
06-01 14:13:36.714   699  7194 W ActivityTaskManager:   Force finishing activity org.commonvoice.saverio/.SpeakActivity
Sav22999 commented 3 years ago

@eppesuig ok, so it looks like a OS bug 🤔 Maybe sometimes a system process is not run and the app can't find the hardware device? Very weird

eppesuig commented 3 years ago

I opened an issue against the operating system. You may find it here. Let's see if it is an OS problem.

Sav22999 commented 3 years ago

@eppesuig Excellent!