Open kgoderis opened 8 years ago
Having null values was only meant for format matching, when a service declares what it supports. A concrete AudioFormat (of a stream) was supposed to have all meta-data correctly filled in.
But I see your issue: When reading WAV or mp3 from the file system, you stand no chance to figure out their bitrate etc. So yes, the code should be adapted to also be able to cope with incomplete format information.
At various places in the codebase we create AudioFormats with a lot of null values for things like frequency (for example JavaSoundAudioSink line #45). Feeding those AudioFormat objects to the method mentioned above, in order to convert them to an javax.sound.sampled.audioformat will throw an NPE in lines 113 and beyond. In my use case, feeding a .wav file (from the filesystem) with an AudioFormat with a bunch of null's for frequency,... , to the javasound sink throws the NPE as it goes through the convertAudioFormat() method