android-aac-enc
android-aac-enc copied to clipboard
android 5.0 crash
android-aac-enc android 5.0 problem: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x82df8000 in tid 12653 (Thread-589)
Having the same....what might be the problem?
Having the same....
put the libaac-encoder in to the armeabi-v7a and armeabi
final String name = files.get(postion).getParentFile().getAbsolutePath() + "/" + files.get(postion).getName().replace(".wav", ".mp4");
AACEncoder aacEncoder = new AACEncoder();
ByteArrayOutputStream bos = null;
int size = 0;
byte[] buffer = null;
try {
File file = files.get(postion);
FileInputStream fis = new FileInputStream(file);
bos = new ByteArrayOutputStream();
byte[] b = new byte[1000];
int n;
while ((n = fis.read(b)) != -1) {
bos.write(b, 0, n);
}
bos.size();
fis.close();
bos.close();
buffer = bos.toByteArray();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Uri uri = Uri.parse(files.get(postion).getAbsolutePath());
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(this,uri);
String durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
int millSecond = Integer.parseInt(durationStr);
int bitRate = Integer.parseInt(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE));
Log.e("xxx", bitRate + "");
aacEncoder.init(bitRate, 1, 44100, 16, name.replace(".mp4", ".aac"));
aacEncoder.encode(buffer);
aacEncoder.uninit();
work normal!