Closed akshatbaranwal closed 5 months ago
![Uploading image_2024_01_16T07_28_06_824Z.png…]() The same issue
Well, of course I can't reproduce this...
@ProFive Are you able to reproduce it with a device that you own? If so, is this reproducible with the example project to get away from other unknown factors? Is there any log that would be useful in this case?
@llfbandit Hi, here is an example of Android logs that might be related to this case. Audio is recorded using record v5.0.4 on a Huawei device Huawei P40 Lite with EMUI 12.0.4 - it should be based on Android 10 I believe. After that it's being played with AudioPlayer
Audio sink error E/MediaCodecAudioRenderer( 5425): com.google.android.exoplayer2.audio.AudioSink$UnexpectedDiscontinuityException: Unexpected audio track timestamp discontinuity: expected 1000000232199, got 1000000023219 E/MediaCodecAudioRenderer( 5425): at com.google.android.exoplayer2.audio.DefaultAudioSink.handleBuffer(DefaultAudioSink.java:999) E/MediaCodecAudioRenderer( 5425): at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.processOutputBuffer(MediaCodecAudioRenderer.java:709) E/MediaCodecAudioRenderer( 5425): at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1889) E/MediaCodecAudioRenderer( 5425): at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:782) E/MediaCodecAudioRenderer( 5425): at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1007) E/MediaCodecAudioRenderer( 5425): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:502) E/MediaCodecAudioRenderer( 5425): at android.os.Handler.dispatchMessage(Handler.java:106) E/MediaCodecAudioRenderer( 5425): at android.os.Looper.loop(Looper.java:219) E/MediaCodecAudioRenderer( 5425): at android.os.HandlerThread.run(HandlerThread.java:67) E/MediaCodecAudioRenderer( 5425): Audio sink error
I'm experiencing the same issue on older Android devices (API 29). It did not occur with version 4.4.4 but does with version 5.0.4. Interestingly, the issue does not appear on API 34 either. Here's the RecordConfig I'm using:
RecordConfig( encoder: AudioEncoder.aacLc, bitRate: 128000, sampleRate: 44100, numChannels: 1, );
When audio recorded with this configuration is played using the Just Audio plugin with player.setAudioSource, the error occurs.
Is it better with version 5.0.5 and record_android 1.1.0?
Device: Oppo Reno A Android Version: 9 record version: 5.0.5 record_android version: 1.1.0
I'm not sure if this is related to the issue I'm experiencing, but when I attempt to start recording in the record example project under the above conditions, it crashes.
The line where it crashes: await recordFile(_audioRecorder, config);
Error message:
I/.record_exampl(25781): ProcessProfilingInfo new_methods=1785 is saved saved_to_disk=1 resolve_classes_delay=5000
W/AudioCapabilities(25781): Unsupported mime audio/ffmpeg
W/VideoCapabilities(25781): Unsupported mime video/ffmpeg
W/VideoCapabilities(25781): Unsupported mime video/divx
W/VideoCapabilities(25781): Unsupported mime video/divx4
W/VideoCapabilities(25781): Unrecognized profile 4 for video/hevc
W/VideoCapabilities(25781): Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities(25781): Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities(25781): Unsupported mime video/x-ms-wmv
I/VideoCapabilities(25781): Unsupported profile 4 for video/mp4v-es
I/flutter (25781): [ id: 14
I/flutter (25781): label: CPH1983 (built-in microphone, bottom)
I/flutter (25781): , id: 15
I/flutter (25781): label: CPH1983 (built-in microphone, back)
I/flutter (25781): , id: 11
I/flutter (25781): label: CPH1983 (FM tuner, )
I/flutter (25781): ]
D/IAtlas (25781): IAtlas::init CallingPid 25781
D/IAtlas (25781): IAtlas::init this 0x6fc7945f00
D/AudioRecord(25781): set() inputSource 0, sampleRate 44100, format 0x1, channelMask 0x10, frameCount 7168, notificationFrames 0, sessionId 0, transferType 0, flags 0, opPackageName com.llfbandit.record_example uid -1, pid -1
I/MediaCodec(25781): CreateByComponentName(), name = OMX.google.aac.encoder
I/MediaCodec(25781): new MediaCodec()
I/ACodec (25781): new ACodec()
I/ACodec (25781): onAllocateComponent()
I/OMXClient(25781): IOmx service obtained
I/ACodec (25781): Successfully allocate component [OMX.google.aac.encoder]
I/MediaCodec(25781): configure format is:{sample-rate=44100, mime=audio/mp4a-latm, channel-count=1, bitrate=128000, aac-profile=2}
I/MediaCodec(25781): configure()
I/ACodec (25781): configureCodec() mime = audio/mp4a-latm
W/ExtendedACodec(25781): Failed to get extension for extradata parameter
D/AudioRecord(25781): start() sync event 0 trigger session 0
D/AudioRecord(25781): 2024-03-28 18:27:26
For your information, I did not experience this crash on other devices I have (with Android 12 and Android 14). Thank you!
same error in android 8 and 9. java.lang.IllegalStateException: Failed to stop the muxer Stack traces: android.media.MediaMuxer.nativeStop MediaMuxer.java android.media.MediaMuxer.stop MediaMuxer.java:454 m6.d.b o6.c.g o6.c.onOutputBufferAvailable android.media.MediaCodec$EventHandler.handleCallback MediaCodec.java:1699 android.media.MediaCodec$EventHandler.handleMessage MediaCodec.java:1646 android.os.Handler.dispatchMessage Handler.java:106 android.os.Looper.loop Looper.java:201 android.app.ActivityThread.main ActivityThread.java:6831 java.lang.reflect.Method.invoke Method.java com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:547 com.android.internal.os.ZygoteInit.main ZygoteInit.java:927
Package version 5.0.4
Environment Android
Describe the bug
On certain Android devices, the audio file created is of 0 bytes. No such issues on version 4.4.4 RecordConfig( echoCancel: false, noiseSuppress: false, autoGain: false, numChannels: 1, encoder: AudioEncoder.aacLc, sampleRate: 44100, )
To Reproduce I could not reproduce it as the issue didn't occur on any of my devices. It happened on the client's device. I released a new version of the app with 4.4.4 and it started working for everyone who had been facing this issue.