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

Commit 922a8c0a authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Use switch in callback handler for events, and no EVENT_MORE_DATA"

parents 270d1460 5b1576cc
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -91,12 +91,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(
@@ -108,8 +105,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(
@@ -121,7 +119,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
@@ -131,12 +131,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(
@@ -148,8 +144,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(
@@ -161,7 +158,9 @@ static void audioCallback(int event, void* user, void *info) {
                env->ExceptionClear();
            }
        }
        } break;
    }

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