thetwom / toc2

Metronome app
GNU General Public License v3.0
159 stars 23 forks source link

Issue with the audio decoding on some devices. #10

Closed thetwom closed 4 years ago

thetwom commented 4 years ago

I think there is an issue with the audio decoding on some devices. On my device (Lineage 14.1) the App is unusable, all the sounds are just noise. I have even downloaded the resources from the repository to check if those were the intended sounds. The flaac files play correctly on my PC.

Originally posted by @tarikgraba in https://github.com/thetwom/toc2/issues/9#issuecomment-650528755

thetwom commented 4 years ago

thanks for the report. Audio decoding really seems to be device specific causing lots of trouble. Maybe I have to find a more robust approach in future. But maybe we can find out why this causes trouble for you. Could you install the apk of a decoding test I have written [DecoderTest]{https://github.com/thetwom/DecoderTest/releases/tag/v8.0} After start, can you press "decode next track" once and post a screenshot of a result. Then press "decode next track" again and also post a screenshot. This would give me some insight about the decoding of two different tracks used in the metronome app.

tarikgraba commented 4 years ago

The logcat:

06-27 12:53:00.185  3369  3467 D AudioService: Stream muted, skip playback
06-27 12:53:00.186  1746  1746 V DecoderTest: openRawRessource
06-27 12:53:00.187  1746  1746 V DecoderTest: Done
06-27 12:53:00.188  1746  1746 V DecoderTest: setDataSource with fileDescriptor=java.io.FileDescriptor@f673229, startOffset=1912308, length=100
06-27 12:53:00.190  1746  1746 E WVMExtractor: Failed to open libwvm.so: dlopen failed: library "libwvm.so" not found
06-27 12:53:00.197  3046  3130 I FFmpegExtractor: android-source:0xf356e400
06-27 12:53:00.199  3046  3130 D FFmpegExtractor: unsupported codec (flac) by official Stagefright
06-27 12:53:00.199  3046  3130 D FFmpegExtractor: ffmpeg detected media content as 'audio/flac' with confidence 0.88
06-27 12:53:00.204  3046  3130 I FFmpegExtractor: stream_index: 0
06-27 12:53:00.204  3046  3130 I FFmpegExtractor: support the codec(flac) disposition(0)
06-27 12:53:00.204  3046  3130 I hexdump : 00000000:  10 00 10 00 00 00 0e 00  00 0e 0b b8 01 70 00 00  .............p..
06-27 12:53:00.204  3046  3130 I hexdump : 00000010:  02 93 62 2a 85 d5 e5 a2  0e 7d 8f ff 81 6f ef f3  ..b*.....}...o..
06-27 12:53:00.204  3046  3130 I hexdump : 00000020:  f2 51                                             .Q
06-27 12:53:00.205  3046  3130 D FFmpegExtractor: bit_rate: 0, sample_rate: 48000, channels: 1, bits_per_coded_sample: 0, block_align: 0 bits_per_raw_sample: 24, sample_format: 2
06-27 12:53:00.205  3046  3130 I FFmpegExtractor: the time is 00:00:00.01
06-27 12:53:00.205  3046  3130 D FFmpegExtractor: Reader thread starting
06-27 12:53:00.205  3046  3130 D FFmpegExtractor: supported mime: audio/flac
06-27 12:53:00.205  3046  3130 I MediaExtractor: Use extended extractor for the special mime(audio/flac) or codec
06-27 12:53:00.207  1746  1746 V DecoderTest: Done
06-27 12:53:00.208  1746  1746 V DecoderTest: getTrackFormat
06-27 12:53:00.210  1746  1746 V DecoderTest: Done
06-27 12:53:00.210  1746  1746 V DecoderTest: getMime
06-27 12:53:00.211  1746  1746 V DecoderTest: mime=audio/flac
06-27 12:53:00.211  1746  1746 V DecoderTest: getSampleRate
06-27 12:53:00.211  1746  1746 V DecoderTest: samplRate=48000
06-27 12:53:00.211  1746  1746 V DecoderTest: getDuration
06-27 12:53:00.211  1746  1746 V DecoderTest: duration=13729
06-27 12:53:00.211  1746  1746 V DecoderTest: getChannelCount
06-27 12:53:00.211  1746  1746 V DecoderTest: channelCount=1
06-27 12:53:00.211  1746  1746 V DecoderTest: create media codec list
06-27 12:53:00.217  1746  1746 W VideoCapabilities: Unrecognized profile/level 1/32 for video/mp4v-es
06-27 12:53:00.218  1746  1746 W VideoCapabilities: Unrecognized profile/level 32768/2 for video/mp4v-es
06-27 12:53:00.218  1746  1746 W VideoCapabilities: Unrecognized profile/level 32768/64 for video/mp4v-es
06-27 12:53:00.260  1746  1746 W VideoCapabilities: Unrecognized profile/level 1/32 for video/mp4v-es
06-27 12:53:00.260  1746  1746 W VideoCapabilities: Unrecognized profile/level 32768/2 for video/mp4v-es
06-27 12:53:00.261  1746  1746 W VideoCapabilities: Unrecognized profile/level 32768/64 for video/mp4v-es
06-27 12:53:00.299  1746  1746 I VideoCapabilities: Unsupported profile 4 for video/mp4v-es
06-27 12:53:00.335  1746  1746 W AudioCapabilities: Unsupported mime audio/ac3
06-27 12:53:00.336  1746  1746 W AudioCapabilities: Unsupported mime audio/alac
06-27 12:53:00.339  1746  1746 W AudioCapabilities: Unsupported mime audio/x-ape
06-27 12:53:00.341  1746  1746 W AudioCapabilities: Unsupported mime audio/ffmpeg
06-27 12:53:00.342  1746  1746 W AudioCapabilities: Unsupported mime audio/dts
06-27 12:53:00.346  1746  1746 W AudioCapabilities: Unsupported mime audio/mpeg-L2
06-27 12:53:00.348  1746  1746 W AudioCapabilities: Unsupported mime audio/vnd.rn-realaudio
06-27 12:53:00.350  1746  1746 W AudioCapabilities: Unsupported mime audio/x-ms-wma
06-27 12:53:00.352  1746  1746 W VideoCapabilities: Unsupported mime video/divx
06-27 12:53:00.358  1746  1746 W VideoCapabilities: Unsupported mime video/x-flv
06-27 12:53:00.373  1746  1746 W VideoCapabilities: Unsupported mime video/vnd.rn-realvideo
06-27 12:53:00.381  1746  1746 W VideoCapabilities: Unsupported mime video/vc1
06-27 12:53:00.388  1746  1746 W VideoCapabilities: Unsupported mime video/ffmpeg
06-27 12:53:00.395  1746  1746 W VideoCapabilities: Unsupported mime video/x-ms-wmv
06-27 12:53:00.401  1746  1746 V DecoderTest: get media codec name
06-27 12:53:00.403  1746  1746 V DecoderTest: mediaCodecName=OMX.ffmpeg.flac.decoder
06-27 12:53:00.404  1746  1746 V DecoderTest: nFrames=659 , nFramesDouble=658.992
06-27 12:53:00.404  1746  1746 V DecoderTest: createDecoderByType
06-27 12:53:00.411  3048  3048 I MediaPlayerService: MediaPlayerService::getOMX
06-27 12:53:00.414  1746  1786 I OMXClient: MuxOMX ctor
06-27 12:53:00.420  3044 20911 I OMXMaster: makeComponentInstance(OMX.ffmpeg.flac.decoder) in mediacodec process
06-27 12:53:00.420  3044 20911 V FFmpegOMXPlugin: makeComponentInstance 'OMX.ffmpeg.flac.decoder'
06-27 12:53:00.421  3044 20911 D SoftFFmpegAudio: SoftFFmpegAudio component: OMX.ffmpeg.flac.decoder mCodingType: 28
06-27 12:53:00.424  1746  1746 V DecoderTest: Done
06-27 12:53:00.425  1746  1746 V DecoderTest: configuring codec
06-27 12:53:00.430  1746  1746 V DecoderTest: Done
06-27 12:53:00.430  1746  1746 V DecoderTest: starting codec
06-27 12:53:00.439  1746  1746 V DecoderTest: Done
06-27 12:53:00.439  1746  1746 V DecoderTest: selecting track
06-27 12:53:00.441  1746  1746 V DecoderTest: Done
06-27 12:53:00.442  3044  1787 I SoftFFmpegAudio: got extradata, ignore: 0, size: 34
06-27 12:53:00.442  1746  1746 V DecoderTest: dequeInputBuffer
06-27 12:53:00.442  3044  1787 I hexdump : 00000000:  10 00 10 00 00 00 0e 00  00 0e 0b b8 01 70 00 00  .............p..
06-27 12:53:00.442  3044  1787 I hexdump : 00000010:  02 93 62 2a 85 d5 e5 a2  0e 7d 8f ff 81 6f ef f3  ..b*.....}...o..
06-27 12:53:00.442  3044  1787 I hexdump : 00000020:  f2 51                                             .Q
06-27 12:53:00.442  1746  1746 V DecoderTest: Done
06-27 12:53:00.442  1746  1746 V DecoderTest: getInputBuffer
06-27 12:53:00.443  1746  1746 V DecoderTest: Done
06-27 12:53:00.443  1746  1746 V DecoderTest: read sample data
06-27 12:53:00.444  1746  1746 V DecoderTest: Done
06-27 12:53:00.444  1746  1746 V DecoderTest: queue input buffer
06-27 12:53:00.445  1746  1746 V DecoderTest: Done
06-27 12:53:00.445  3044  1787 I SoftFFmpegAudio: extradata is ready, size: 34
06-27 12:53:00.445  1746  1746 V DecoderTest: advance media extractor
06-27 12:53:00.445  3044  1787 I hexdump : 00000000:  10 00 10 00 00 00 0e 00  00 0e 0b b8 01 70 00 00  .............p..
06-27 12:53:00.445  1746  1746 V DecoderTest: Done
06-27 12:53:00.445  3044  1787 I hexdump : 00000010:  02 93 62 2a 85 d5 e5 a2  0e 7d 8f ff 81 6f ef f3  ..b*.....}...o..
06-27 12:53:00.446  1746  1746 V DecoderTest: deque output buffer
06-27 12:53:00.446  3044  1787 I hexdump : 00000020:  f2 51                                             .Q
06-27 12:53:00.446  3044  1787 D SoftFFmpegAudio: begin to open ffmpeg audio decoder(flac), mCtx sample_rate: 48000, channels: 1
06-27 12:53:00.446  3044  1787 D SoftFFmpegAudio: open ffmpeg audio decoder(flac) success, mCtx sample_rate: 48000, channels: 1, sample_fmt: s32, bits_per_coded_sample: 0, bits_per_raw_sample: 24
06-27 12:53:00.448  1746  1746 V DecoderTest: Done
06-27 12:53:00.448  1746  1746 V DecoderTest: dequeInputBuffer
06-27 12:53:00.448  1746  1746 V DecoderTest: Done
06-27 12:53:00.448  1746  1746 V DecoderTest: getInputBuffer
06-27 12:53:00.448  1746  1746 V DecoderTest: Done
06-27 12:53:00.449  1746  1746 V DecoderTest: read sample data
06-27 12:53:00.449  3046  3728 D FFmpegExtractor: read audio eos pkt
06-27 12:53:00.450  1746  1746 V DecoderTest: Done
06-27 12:53:00.450  1746  1746 V DecoderTest: queue input buffer
06-27 12:53:00.450  1746  1746 V DecoderTest: Done
06-27 12:53:00.450  3044  1787 D SoftFFmpegAudio: ffmpeg audio decoder eos
06-27 12:53:00.450  1746  1746 V DecoderTest: deque output buffer
06-27 12:53:00.450  3044  1787 D SoftFFmpegAudio: ffmpeg audio decoder fill eos outbuf
06-27 12:53:00.451  1746  1746 V DecoderTest: Done
06-27 12:53:00.451  1746  1746 V DecoderTest: deque output buffer
06-27 12:53:00.452  1746  1746 V DecoderTest: Done
06-27 12:53:00.452  1746  1746 V DecoderTest: get output buffer
06-27 12:53:00.452  1746  1746 V DecoderTest: Done
06-27 12:53:00.456  1746  1746 V DecoderTest: release output buffer
06-27 12:53:00.457  1746  1746 V DecoderTest: Done
06-27 12:53:00.457  1746  1746 V DecoderTest: deque output buffer
06-27 12:53:00.458  1746  1746 V DecoderTest: Done
06-27 12:53:00.458  1746  1746 V DecoderTest: get output buffer
06-27 12:53:00.458  1746  1746 V DecoderTest: Done
06-27 12:53:00.458  1746  1746 V DecoderTest: release output buffer
06-27 12:53:00.458  1746  1746 V DecoderTest: Done
06-27 12:53:00.459  1746  1746 V DecoderTest: COUNTER: 4
06-27 12:53:00.467  3046  3130 D FFmpegExtractor: Reader thread stopped
06-27 12:53:00.467  1746  1746 V DecoderTest: scaling result
06-27 12:53:00.504  1746  1751 I art     : Compiler allocated 4MB to compile float[] de.moekadu.decodertest.MainActivity.audioToPCM(int, java.lang.StringBuilder)
06-27 12:53:00.544  1746  1751 I art     : Compiler allocated 4MB to compile float[] de.moekadu.decodertest.MainActivity.audioToPCM(int, java.lang.StringBuilder)
tarikgraba commented 4 years ago

screen

thetwom commented 4 years ago

thanks a lot, so far this looks correct. Could yo press "Decode next track" twice (such that the first line says "Decoding sound 1") and print a screen shot. Track 0 is just a mute track, so it does not contain too much information. For now, a screenshot is enough. But it's great to know you can post the logcat. This might simplify things for further debuggin.

thetwom commented 4 years ago

I actually updated the test ...maybe you could install the update, [DecoderTest v9.0]{https://github.com/thetwom/DecoderTest/releases/tag/v9.0}, and start it. No pressing on "Decoded next track" needed anymore. Just post a screenshot of the app after it started.

tarikgraba commented 4 years ago

snd2 snd1 snd0

thetwom commented 4 years ago

Thanks for the further screenshots. Looks, like the ffmpeg-flac decoder which is used on your device, behaves in a (at least for me) unexpected way.

I simplified the situation, reading simple wav-files now instead of decoding flac-files. This will hopefully avoid such problems in future. Could you try version v1.6.5-beta and report if this works for you?

tarikgraba commented 4 years ago

I've just tested the beta version and everything sounds ok. I will also check the update on f-droid as soon as it is available.

THX

thetwom commented 4 years ago

Thanks for testing. Good to hear that it works now. I will use the beta during my next practise session, to double-check everything is fine and then tag it as a release.

I won't bring the beta to fdroid, since fdroid does not support this very well (you basically have to send a change request for each beta). On the other hand, normal releases are picked up automatically.

axel-rank commented 4 years ago

Sounds working in latest release (1.6.5).