boolean encodingOk = false;
for (int i = 0; i < track.length; i++) {
if (!encodingOk && track[i] instanceof FormatControl) {
if (((FormatControl)track[i]).setFormat( new AudioFormat(AudioFormat.GSM_RTP,8000,8,1)) == null) {
track[i].setEnabled(false);
}
else {
encodingOk = true;
}
}
else {
track[i].setEnabled(false);
}
}
if(!encodingOk){
throw new VoiceException("Error on track.setFormat ");
}
if (!mStateHelper.realize(10000)) {
throw new VoiceException("Error realizing processor");
}
Code.debug(" - Realize Processor ok ");
//第四步:取出DataSource
try {
mDataSource = mProcessor.getDataOutput();
} catch (NotRealizedError e){
throw new VoiceException("Not Realize Error:"+e.getMessage());
}
Code.debug(" - Get DataSource ok ");