HomeForumsOpenEars[Resolved] insert headphones: EXC_BAD_ACCESS in fliteDidStartSpeaking

This topic has 3 voices, contains 23 replies, and was last updated by  Halle 112 days ago.

Viewing 24 posts - 1 through 24 (of 24 total)
Author Posts
Author Posts
November 2, 2011 at 2:46 pm #7840

mludlum

First: Thank you very much for this library and EXCELLENT setup instructions.

I have an app that uses sphinx and flite for command/response.
I’m testing my app with and without headphones. I get a consistent crash in PocketsphinxController.mm in fliteDidStartSpeaking when I insert headphones on this line:

if(self.continuousModel.inMainRecognitionLoop == TRUE && [[NSString stringWithFormat:@"%@",[self.continuousModel getCurrentRoute]] isEqualToString:@”HeadsetInOut”]==FALSE) { // Only resume listening if we suspended it due to not using headphones

If I enabled zombies, I get
[CFString respondsToSelector:]: message sent to deallocated instance 0x3c69170

Just guessing-> Does setCurrentRouteTo need a retain?

Testing with XCode 4.2, iPhone 3GS with iOS 5.

November 2, 2011 at 5:07 pm #7841

Halle

Welcome,

Thanks for the report, I will check into it. Without having looked at it yet I suspect you’re correct that the string is released at the time it is compared.

November 6, 2011 at 9:56 am #7923

Halle

Quick question: are you using the Apple LLVM compiler or GCC?

November 6, 2011 at 12:30 pm #7924

mludlum

LLVM

November 6, 2011 at 6:21 pm #7925

Halle

Would you mind terribly seeing if the bug is still there when you compile with GCC and letting me know? There seems to be a general Apple LLVM incompatibility.

November 7, 2011 at 5:14 pm #7927

mludlum

I switched the compiler of my main project from Apple LLVM compiler 3.0 to LLVM GCC 4.2. I ran clean and then rebuilt. The problem still occurs. All I have to do is insert or remove the headphones.

November 7, 2011 at 9:32 pm #7929

Halle

OK, thanks for getting back to me on it.

November 7, 2011 at 10:08 pm #7930

mludlum

So, I modified setCurrentRouteTo as follows as a workaround. I added a call to retain, which may be causing a memory leak in other situations. I haven’t tested that yet. Also note, I changed the & operator to a && because it was crashing when audioDevice is nil.

- (void) setCurrentRouteTo:(NSString *)newRoute {
if(audioDevice != NULL && audioDevice->currentRoute != NULL) {
[newRoute retain];
audioDevice->currentRoute = (CFStringRef)newRoute;
}
}

January 23, 2012 at 12:43 am #8527

kremizask

How was this issue resolved? I am having the same issue even when not inserting headphones. I tried the above workaround suggested by mludlum but it didn’t work for me.
Using Xcode 4.2.1, iOS 5.0 and Apple LLVM 3.0.

January 23, 2012 at 10:44 am #8528

Halle

What does your OPENEARSLOGGING say before the crash?

January 26, 2012 at 12:24 pm #8545

kremizask

I get the following logs:

2012-01-26 13:18:07.510 Demo[5474:3503] OPENEARSLOGGING: Listening.
2012-01-26 13:18:08.214 Demo[5474:707] OPENEARSLOGGING: I’m done running flite and it took 1.032749 seconds
2012-01-26 13:18:08.216 Demo[5474:707] OPENEARSLOGGING: Flite audio player was nil when referenced so attempting to allocate a new audio player.
2012-01-26 13:18:08.219 Demo[5474:707] OPENEARSLOGGING: Loading speech data for Flite concluded successfully.
2012-01-26 13:18:08.249 Demo[5474:707] Pocketsphinx is now listening.
2012-01-26 13:18:08.251 Demo[5474:707] OPENEARSLOGGING: Flite sending suspend recognition notification.
2012-01-26 13:18:08.254 Demo[5474:707] Flite has started speaking

And then the EXC_BAD_ACCESS error.

January 26, 2012 at 12:35 pm #8546

kremizask

I forgot to mention that this crash happens only when running on the device (4S) and not when running on the simulator.

January 26, 2012 at 10:48 pm #8547

Halle

Is it happening in the sample app?

January 26, 2012 at 10:51 pm #8548

kremizask

No, it is not.

January 26, 2012 at 11:19 pm #8551

Halle

Does it happen in your app with GCC?

January 27, 2012 at 1:09 am #8553

kremizask

With GCC I get the following compiler errors:
1. main.m:15: error: expected expression before ‘@’ token
2. AppDelegate.h:15: error: expected a property attribute before ‘strong’.

January 27, 2012 at 11:08 am #8555

Halle

OK, that’s because you’re using ARC. I will test on the 4S with LLVM.

January 27, 2012 at 11:22 am #8556

kremizask

Actually I am not using ARC. Is there any chance I have some setting in the Open Ears Config files wrong?

January 27, 2012 at 11:50 am #8558

Halle

I think you have a strong ownership setting somewhere in your app due to ARC or you wouldn’t be getting that error. What’s on line 15 of your app delegate header?

Is there any chance I have some setting in the Open Ears Config files wrong?

The behavior sounds vaguely like what happens when you try to use a voice that you don’t have commented out in OpenEarsVoiceConfig.h except that that would show up in the logging. I’ll try it out myself today with the same setup and device as you and let you know.

January 27, 2012 at 1:45 pm #8565

Halle

[Partially reposted from the other thread on the same subject above]

Hmm, I just tested this on the 4S by converting the sample app to ARC (but not the library) and using LLVM. I can’t replicate; flite is working fine with multiple voices. Do you want to send me a sample app that fails? If so I’ll get in touch at the email you used for registration. If you don’t want to do that, something you can do is convert the sample app to ARC/LLVM and then diff it against your app to see what is different about your app. Then you can probably tell me in a general sense what the environmental differences are which should give me a better chance of replicating the issue you’re seeing. If it is a config mistake, that should also show you where it is. I realize there will be a lot of other differences to wade through, so the best bet is to make a very simplified version of your own app to compare against the converted sample app and then introduce your other differences systematically until it breaks and you know what the culprit is.

January 27, 2012 at 5:02 pm #8566

kremizask

The code is available on github (https://github.com/NiobiumLabs/Siri-Wolfram). The controller that uses Open Ears methods is SearchViewController. Thanks in advance for your help.

January 27, 2012 at 5:28 pm #8567

Halle

Having given it a quick look, where do you start the audio session? I see the lazy instantiation method but I don’t see the object being used anywhere.

January 27, 2012 at 5:52 pm #8568

kremizask

Hmm… You are correct. I don’t. I thought I was starting it in application:didFinishLaunchingWithOptions: apparently I am not. Thanks for your help. It seems to be working now.

January 27, 2012 at 6:00 pm #8569

Halle

Glad to hear it.

Viewing 24 posts - 1 through 24 (of 24 total)

You must be logged in to reply to this topic.