learning the hard way
root cause found (i think). lesson: java functions called via jni dont handle exceptions/tell you what happens when they crash.
This commit is contained in:
parent
2403d13440
commit
3e33efa3ca
|
@ -781,7 +781,7 @@ struct maple_microphone: maple_base
|
|||
{
|
||||
case 0x01:
|
||||
{
|
||||
LOGI("maple_microphone::dma MDCF_MICControl someone wants some data! (2nd word) %#010x\n", subcommand);
|
||||
//LOGI("maple_microphone::dma MDCF_MICControl someone wants some data! (2nd word) %#010x\n", secondword);
|
||||
|
||||
w32(MFID_4_Mic);
|
||||
|
||||
|
@ -804,8 +804,6 @@ struct maple_microphone: maple_base
|
|||
}
|
||||
case 0x02:
|
||||
LOGI("maple_microphone::dma MDCF_MICControl toggle recording %#010x\n",secondword);
|
||||
//this is where i should start recording...
|
||||
|
||||
return MDRS_DeviceReply;
|
||||
case 0x03:
|
||||
LOGI("maple_microphone::dma MDCF_MICControl set gain %#010x\n",secondword);
|
||||
|
|
|
@ -348,7 +348,7 @@ int get_mic_data(u8* buffer)
|
|||
{
|
||||
jbyteArray jdata = (jbyteArray)jenv->CallObjectMethod(sipemu,getmicdata);
|
||||
if(jdata==NULL){
|
||||
LOGW("get_mic_data NULL");
|
||||
//LOGW("get_mic_data NULL");
|
||||
return 0;
|
||||
}
|
||||
jenv->GetByteArrayRegion(jdata, 0, SIZE_OF_MIC_DATA, (jbyte*)buffer);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.reicast.emulator;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import android.media.AudioFormat;
|
||||
import android.media.AudioRecord;
|
||||
|
@ -19,9 +20,8 @@ public class SipEmulator extends Thread {
|
|||
static final int ONE_BLIP_SIZE = 480; //ALSO DEFINED IN maple_devs.h
|
||||
|
||||
private AudioRecord record;
|
||||
private LinkedList<byte[]> bytesReadBuffer;
|
||||
private ConcurrentLinkedQueue<byte[]> bytesReadBuffer;
|
||||
|
||||
//private Thread recordThread;
|
||||
private boolean continueRecording;
|
||||
private boolean firstGet;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class SipEmulator extends Thread {
|
|||
AudioFormat.ENCODING_PCM_16BIT,
|
||||
BUFFER_SIZE);
|
||||
|
||||
bytesReadBuffer = new LinkedList<byte[]>();
|
||||
bytesReadBuffer = new ConcurrentLinkedQueue<byte[]>();
|
||||
|
||||
continueRecording = false;
|
||||
firstGet = true;
|
||||
|
@ -75,7 +75,7 @@ public class SipEmulator extends Thread {
|
|||
|
||||
public byte[] getData(){
|
||||
//Log.d(TAG, "SipEmulator getData called");
|
||||
Log.d(TAG, "SipEmulator getData bytesReadBuffer size: "+bytesReadBuffer.size());
|
||||
//Log.d(TAG, "SipEmulator getData bytesReadBuffer size: "+bytesReadBuffer.size());
|
||||
if(firstGet || bytesReadBuffer.size()>50){//50 blips is about 2 seconds!
|
||||
firstGet = false;
|
||||
return catchUp();
|
||||
|
@ -85,7 +85,7 @@ public class SipEmulator extends Thread {
|
|||
|
||||
private byte[] catchUp(){
|
||||
Log.d(TAG, "SipEmulator catchUp");
|
||||
byte[] last = bytesReadBuffer.removeLast();
|
||||
byte[] last = bytesReadBuffer.poll();
|
||||
bytesReadBuffer.clear();
|
||||
return last;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue