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

Commit 39fcca0a authored by Eric Laurent's avatar Eric Laurent
Browse files

SoundTrigger: fix capture format in recognition event

Also include capture format in recognition event
if capture is available for streaming. It was only
included if trigger was contained in event.

Bug: 17409062
Bug: 16731718
Change-Id: I5bf566e6bda57f23c870b4a1293e9b6d15d51e5a
parent b5928445
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -480,7 +480,7 @@ public class SoundTrigger {
            int capturePreambleMs = in.readInt();
            boolean triggerInData = in.readByte() == 1;
            AudioFormat captureFormat = null;
            if (triggerInData) {
            if (in.readByte() == 1) {
                int sampleRate = in.readInt();
                int encoding = in.readInt();
                int channelMask = in.readInt();
@@ -508,7 +508,8 @@ public class SoundTrigger {
            dest.writeInt(captureSession);
            dest.writeInt(captureDelayMs);
            dest.writeInt(capturePreambleMs);
            if (triggerInData && (captureFormat != null)) {
            dest.writeByte((byte) (triggerInData ? 1 : 0));
            if (captureFormat != null) {
                dest.writeByte((byte)1);
                dest.writeInt(captureFormat.getSampleRate());
                dest.writeInt(captureFormat.getEncoding());
+1 −1
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ void JNISoundTriggerCallback::onRecognitionEvent(struct sound_trigger_recognitio
    }

    jobject jAudioFormat = NULL;
    if (event->trigger_in_data) {
    if (event->trigger_in_data || event->capture_available) {
        jAudioFormat = env->NewObject(gAudioFormatClass,
                                    gAudioFormatCstor,
                                    audioFormatFromNative(event->audio_config.format),