Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b1576cc authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Use switch in callback handler for events, and no EVENT_MORE_DATA

EVENT_MORE_DATA is no longer possible for the transfer mode used by Java.

Change-Id: Iffd98bca8adea7e066d5d069e82aa841e5c02330
parent bc668ac4
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -101,12 +101,9 @@ static void recorderCallback(int event, void* user, void *info) {
        }
        callbackInfo->busy = true;
    }
    if (event == AudioRecord::EVENT_MORE_DATA) {
        // set size to 0 to signal we're not using the callback to read more data
        AudioRecord::Buffer* pBuff = (AudioRecord::Buffer*)info;
        pBuff->size = 0;

    } else if (event == AudioRecord::EVENT_MARKER) {
    switch (event) {
    case AudioRecord::EVENT_MARKER: {
        JNIEnv *env = AndroidRuntime::getJNIEnv();
        if (user && env) {
            env->CallStaticVoidMethod(
@@ -118,8 +115,9 @@ static void recorderCallback(int event, void* user, void *info) {
                env->ExceptionClear();
            }
        }
        } break;

    } else if (event == AudioRecord::EVENT_NEW_POS) {
    case AudioRecord::EVENT_NEW_POS: {
        JNIEnv *env = AndroidRuntime::getJNIEnv();
        if (user && env) {
            env->CallStaticVoidMethod(
@@ -131,7 +129,9 @@ static void recorderCallback(int event, void* user, void *info) {
                env->ExceptionClear();
            }
        }
        } break;
    }

    {
        Mutex::Autolock l(sLock);
        callbackInfo->busy = false;
+6 −7
Original line number Diff line number Diff line
@@ -137,12 +137,8 @@ static void audioCallback(int event, void* user, void *info) {
        callbackInfo->busy = true;
    }

    if (event == AudioTrack::EVENT_MORE_DATA) {
        // set size to 0 to signal we're not using the callback to write more data
        AudioTrack::Buffer* pBuff = (AudioTrack::Buffer*)info;
        pBuff->size = 0;

    } else if (event == AudioTrack::EVENT_MARKER) {
    switch (event) {
    case AudioTrack::EVENT_MARKER: {
        JNIEnv *env = AndroidRuntime::getJNIEnv();
        if (user && env) {
            env->CallStaticVoidMethod(
@@ -154,8 +150,9 @@ static void audioCallback(int event, void* user, void *info) {
                env->ExceptionClear();
            }
        }
        } break;

    } else if (event == AudioTrack::EVENT_NEW_POS) {
    case AudioTrack::EVENT_NEW_POS: {
        JNIEnv *env = AndroidRuntime::getJNIEnv();
        if (user && env) {
            env->CallStaticVoidMethod(
@@ -167,7 +164,9 @@ static void audioCallback(int event, void* user, void *info) {
                env->ExceptionClear();
            }
        }
        } break;
    }

    {
        Mutex::Autolock l(sLock);
        callbackInfo->busy = false;