Exception when transfer live audio to A-LAW
When i transfer the live audio to A-LAW ,some exceptions like below were throwed:
[junit] 09:39-[INFO]- com.cosmact.media.CaptureCore.configureProcessor(Capt
ureCore.java:223) - Out foramt configured...start
[junit] 09:39-[INFO]- com.cosmact.media.CaptureCore.configureProcessor(Capt
ureCore.java:227) - 1 Codecfor AudioForamt.ALAW
[junit] 09:39-[INFO]- com.cosmact.media.CaptureCore.configureProcessor(Capt
ureCore.java:233) - 0 Codec: com.ibm.media.codec.audio.ACMCodec
[junit] 09:39-[INFO]- com.cosmact.media.CaptureCore.configureProcessor(Capt
ureCore.java:262) - Out foramt configured... completed
[junit] Failed to build a graphfor the given custom options.
[junit] Failed to realize: com.sun.media.ProcessEngine@3ee284
[junit]Cannot build a flow graph with the customized options:
[junit]Unable to transcode format: LINEAR, 44100.0 Hz, 16-bit, Stereo,
LittleEndian, Signed
[junit]to: alaw, 8000.0 Hz, 8-bit, Mono
[junit]outputting to: WAV
[junit]Unable to add customed codecs:
[junit]com.ibm.media.codec.audio.ACMCodec@337d0f
[junit] Error: Unable to realize com.sun.media.ProcessEngine@3ee284
[junit]
[junit] Running com.cosmact.test.CaptureCoreTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
The Code for configure the Processor is here:
AudioFormat inputFormat=new AudioFormat(AudioFormat.LINEAR);
AudioFormat outputFormat=new AudioFormat(AudioFormat.ALAW,8000,8000,1);//A-law,1.0 playback rate,8000KBps,1 channel(mono)
Vector v = PlugInManager.getPlugInList(inputFormat,outputFormat,PlugInManager.CODEC);
logger.info(v.size()+" Codec for AudioForamt.ALAW");
String[] codecNames =null;
if (v !=null && v.size() > 0){
codecNames =new String[v.size()];
for (int i = 0; i < v.size(); i++){
codecNames[i] = (String) v.get(i);
logger.info(i+" Codec: "+codecNames[i]);
}
TrackControl[] tracks = processor.getTrackControls();
for (TrackControl c : tracks){
// The track is Linear
c.setFormat(outputFormat);
Codec[] codecs =new Codec[codecNames.length];
for (int k = 0; k < codecs.length; k++){
try{
codecs[k] = (Codec) Class.forName(codecNames[k])
.newInstance();
}catch (InstantiationException e){
logger.error(e.getMessage(), e);
}catch (IllegalAccessException e){
logger.error(e.getMessage(), e);
}catch (ClassNotFoundException e){
logger.error(e.getMessage(), e);
}
}
// ok
try{
c.setCodecChain(codecs);
}catch (UnsupportedPlugInException e){
logger.error(e.getMessage(), e);
}catch (NotConfiguredError e){
logger.error(e.getMessage(), e);
}
}
}
Any one can tell why?
Thanx very much

