ARMv7A Sound Not Working On OpenJDK-11
John Cummings
darkzalgo at gmail.com
Fri Oct 22 16:37:45 UTC 2021
Hello all,
I have been attempting to build OpenJDK-11 for an ARMv7-A system using
Cortex-A7 that currently runs Java 8. After resolving my build issues with
the build-dev mailing list (who sent me here for this issue), I'm able to
make it run on the system, but it cannot play sound and I have been unable
to figure out why. Running the same java applications one after another, 8
will play sound, 11 will crash upon trying to get the source line.
Please let me know if there's any additional information I can provide that
may help!
I have attempted building with two different toolchains, I've used the
branch at https://hg.openjdk.java.net/jdk/jdk11 as well as the one at
https://github.com/openjdk/jdk11u-dev/. I've tried the server, client, and
zero variants of both, with and without fastdebug enabled, and haven't made
much progress with it. I've also tried with java 8 still on the system, and
with deleting it entirely. I've also attempted to add the following to the
sound.properties:
javax.sound.sampled.Clip=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.Port=com.sun.media.sound.PortMixerProvider
javax.sound.sampled.SourceDataLine=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.TargetDataLine=com.sun.media.sound.DirectAudioDeviceProvider
This is the configuration I've been using:
bash configure \
--openjdk-target=arm-unknown-linux-gnueabihf \
--with-native-debug-symbols=none \
--disable-warnings-as-errors \
--with-abi-profile=arm-vfp-hflt \
--disable-ccache \
--with-build-jdk=/opt/openjdk/jdk11u-dev/build/linux-x86_64-normal-server-release/images/jdk
\
--with-sysroot=/opt/buildroot-2017.08/output/host/arm-buildroot-linux-gnueabihf/sysroot/
\
--with-toolchain-path=/opt/x-tools/arm-unknown-linux-gnueabihf/bin \
--with-x=/opt/buildroot-2017.08/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr
\
--with-cups=/opt/sbuildroot-2017.08/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr
\
--with-fontconfig=/opt/buildroot-2017.08/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr
\
--with-freetype-lib=/opt/buildroot-2017.08/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib
\
--with-freetype-include=/opt/buildroot-2017.08/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include
\
--with-alsa=/opt/buildroot-2017.08/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr
\
--with-stdc++lib=dynamic \
--with-extra-cxxflags='-O2 -pipe' \
--with-extra-cflags='-O2 -pipe' \
--with-jobs=8 \
--with-jvm-variants=client
Output of uname -a for this system is
Linux sun6i 3.3.0 #125 SMP PREEMPT Fri Feb 5 07:04:03 CST 2021 armv7l
GNU/Linux
Output of java -version for 8 is
# java8 -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) Client VM (build 25.144-b01, mixed mode)
Output for the newly built 11 is:
# java -version
openjdk version "11.0.14-internal" 2022-01-18
OpenJDK Runtime Environment (build
11.0.14-internal+0-adhoc.johnc.jdk11u-dev)
OpenJDK Client VM (build 11.0.14-internal+0-adhoc.johnc.jdk11u-dev, mixed
mode)
The app I've been collecting information with just gets the mixers, and
any data lines and prints their values, and then plays a .wav file using
SourceDataLine, and again with Clip. I use -Daudio.mixer="M1 PCM [default]"
because in the Java 11 build, setting it to null for the default just
returns null, and it doesn't even return the "Found Audio Mixer" line. If
it helps, here is the java itself: https://pastebin.com/CCfUWTTf
The output is as follows for 8 and 11:
Java 8 output
# java8 -Daudio.mixer="M1 PCM [default]" AudioFormats SuccessBuzzer.wav
Found audio mixer: M1 PCM [default]
Supported Lines of default mixer (M1 PCM [default]):
Mixer ClassName:
com.sun.media.sound.DirectAudioDeviceProvider$DirectAudioDeviceInfo
Mixer Desc: Direct Audio Device: sun7i PCM, M1 PCM, sun7i PCM
Vendor: ALSA (http://www.alsa-project.org)
M1 PCM [default] --- interface SourceDataLine supporting 8 audio
formats, and buffers of at least 32 bytes -----
com.sun.media.sound.DirectAudioDevice$DirectSDL at 873330
M1 PCM [default] --- interface Clip supporting 8 audio formats,
and buffers of at least 32 bytes -----
com.sun.media.sound.DirectAudioDevice$DirectClip at 19d7047
com.sun.media.sound.DirectAudioDevice at 16ec8df --- interface
TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
----- com.sun.media.sound.DirectAudioDevice$DirectTDL at ec7777
Mixer Num Source Info Lines: 2
Mixer Num Target Info Lines: 1
interface SourceDataLine supporting 8 audio formats, and buffers of at
least 32 bytes
max buffer size: -1
min buffer size: 32
Supported Audio formats:
PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame,
little-endian
encoding: PCM_SIGNED
channels: 1
frame size [bytes]: 2
sample size [bit]: 16
big endian: false
line supported: true
PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
encoding: PCM_SIGNED
channels: 1
frame size [bytes]: 2
sample size [bit]: 16
big endian: true
line supported: true
PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame,
little-endian
encoding: PCM_SIGNED
channels: 2
frame size [bytes]: 4
sample size [bit]: 16
big endian: false
line supported: true
PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame,
big-endian
encoding: PCM_SIGNED
channels: 2
frame size [bytes]: 4
sample size [bit]: 16
big endian: true
line supported: true
PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
encoding: PCM_SIGNED
channels: 1
frame size [bytes]: 1
sample size [bit]: 8
big endian: false
line supported: true
PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
encoding: PCM_UNSIGNED
channels: 1
frame size [bytes]: 1
sample size [bit]: 8
big endian: false
line supported: true
PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
encoding: PCM_SIGNED
channels: 2
frame size [bytes]: 2
sample size [bit]: 8
big endian: false
line supported: true
PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
encoding: PCM_UNSIGNED
channels: 2
frame size [bytes]: 2
sample size [bit]: 8
big endian: false
line supported: true
interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
Playing SuccessBuzzer.wav
Source Data Lines: PCM_SIGNED 22050.0 Hz, 16 bit, stereo, 4
bytes/frame, little-endian
encoding: PCM_SIGNED
channels: 2
frame rate [1/s]: 22050.0
frame size [bytes]: 4
sample rate [1/s]: 22050.0
sample size [bit]: 16
big endian: false
line supported: true
Clip Data Lines: PCM_SIGNED 22050.0 Hz, 16 bit, stereo, 4 bytes/frame,
little-endian
encoding: PCM_SIGNED
channels: 2
frame rate [1/s]: 22050.0
frame size [bytes]: 4
sample rate [1/s]: 22050.0
sample size [bit]: 16
big endian: false
line supported: true
Target Data Lines: PCM_SIGNED 22050.0 Hz, 16 bit, stereo, 4
bytes/frame, little-endian
encoding: PCM_SIGNED
channels: 2
frame rate [1/s]: 22050.0
frame size [bytes]: 4
sample rate [1/s]: 22050.0
sample size [bit]: 16
big endian: false
line supported: true
Java 11 Output
# java -Daudio.mixer="M1 PCM [default]" AudioFormats SuccessBuzzer.wav
Found audio mixer: M1 PCM [default]
Supported Lines of default mixer (M1 PCM [default]):
Mixer ClassName:
com.sun.media.sound.DirectAudioDeviceProvider$DirectAudioDeviceInfo
Mixer Desc: Direct Audio Device: sun7i PCM, M1 PCM, sun7i PCM
Vendor: ALSA (http://www.alsa-project.org)
Mixer Has 0 Source Info Lines:
Mixer Has 0 Target Info Lines:
Playing SuccessBuzzer.wav
Source Data Lines: PCM_SIGNED 22050.0 Hz, 16 bit, stereo, 4
bytes/frame, little-endian
encoding: PCM_SIGNED
channels: 2
frame rate [1/s]: 22050.0
frame size [bytes]: 4
sample rate [1/s]: 22050.0
sample size [bit]: 16
big endian: false
line supported: false
Clip Data Lines: PCM_SIGNED 22050.0 Hz, 16 bit, stereo, 4 bytes/frame,
little-endian
encoding: PCM_SIGNED
channels: 2
frame rate [1/s]: 22050.0
frame size [bytes]: 4
sample rate [1/s]: 22050.0
sample size [bit]: 16
big endian: false
line supported: false
Target Data Lines: PCM_SIGNED 22050.0 Hz, 16 bit, stereo, 4
bytes/frame, little-endian
encoding: PCM_SIGNED
channels: 2
frame rate [1/s]: 22050.0
frame size [bytes]: 4
sample rate [1/s]: 22050.0
sample size [bit]: 16
big endian: false
line supported: false
java.lang.IllegalArgumentException: No line matching interface
SourceDataLine supporting format PCM_SIGNED 22050.0 Hz, 16 bit, stereo, 4
bytes/frame, little-endian is supported.
at
java.desktop/javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:425)
at AudioFormats.main(AudioFormats.java:77)
java.lang.IllegalArgumentException: No line matching interface Clip
supporting format PCM_SIGNED unknown sample rate, 16 bit, stereo, 4
bytes/frame, big-endian is supported.
at
java.desktop/javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:425)
at
java.desktop/javax.sound.sampled.AudioSystem.getClip(AudioSystem.java:461)
at AudioFormats.main(AudioFormats.java:94)
On another application I've also had an error pointing to the
DirectAudioDevice.java that also plays the same .wav file.
Caused by: java.lang.IllegalArgumentException: Line unsupported: interface
SourceDataLine
at
java.desktop/com.sun.media.sound.DirectAudioDevice.getLine(DirectAudioDevice.java:175)
at
java.desktop/javax.sound.sampled.AudioSystem.getSourceDataLine(AudioSystem.java:572)
Here's aplay output for that file too in case that helps:
#aplay -vvv SuccessBuzzer.wav
Playing WAVE 'SuccessBuzzer.wav' : Signed 16 bit Little Endian, Rate 22050
Hz, Stereo
Hardware PCM card 0 'audiocodec' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 22050
exact rate : 22050 (22050/1)
msbits : 16
buffer_size : 8192
period_size : 2048
period_time : 92879
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 2048
period_event : 0
start_threshold : 8192
stop_threshold : 8192
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
Max peak (4096 samples): 0x0000095f ## 7%
Max peak (4096 samples): 0x00001a62 ##### 20%
Max peak (4096 samples): 0x00001b1c ##### 21%
Max peak (4096 samples): 0x0000182c #### 18%
Max peak (4096 samples): 0x000005de # 4%
Max peak (4096 samples): 0x00000451 # 3%
Max peak (4096 samples): 0x000001d5 # 1%
Thanks,
John Cummings
More information about the client-libs-dev
mailing list