I’m using Xuggler to encode AAC audio and send the packets to a Publisher. The encode process seems to work fine, but it seems that I’m having a problem getting the channels property of the AACFrame to set properly
My code is as follows:
AACFrame frame = new AACFrame();
int sampleRate = 44100;
int channels = 2;
frame.setSampleRate(44100);
frame.setChannels(2);
frame.setRateIndex(AACUtils.sampleRateToIndex(sampleRate));
frame.setChannelIndex(AACUtils.channelCountToIndex(sampleRate));
frame.setProfileObjectType(1);
byte[] codecConfig = new byte[2];
AACUtils.encodeAACCodecConfig(frame, codecConfig, 0);
byte[] finalConfig = new byte[codecConfig.length+2];
byte header = (byte)0xaf;
finalConfig[0] = (byte)0xaf;
finalConfig[1] = (byte)0;
System.arraycopy(codecConfig, 0, finalConfig, 2, codecConfig.length);
I’ve tried sending this packet to the publisher once before starting audio packets, and also once before each audio packet. The results are the same…
When I read the stream in on another wowza server, it looks like the config packet is reporting 0 channels:
[mp4a.40.1]: AAC Audio info: {AACFrame: size: 0, rate: 44100, channels: 0, samples: 1024, errorBitsAbsent: true, profileObjectType: “Main”}
The sample rate, samples per packet, and profileObjectType are coming across as expected, but channels always reads 0. I can play the stream on VLC and on Android over RTSP, but VLC reports an error on the channels value, and the stream cannot be played by iOS or Flash.
I’ve also tried with the LC profile… same results.
ideas?