Friday, November 21, 2008

tinkering with the RecordControl and Player

Well I have been seeking better performance. In order to find out where the code is inefficient, I tried the Nokia SDK with it's profiling tools. But that was unsuccessful.

I had the idea of putting some timestamp code in the recording loop. But I had a problem, I wasn't sure how to get the timestamps out of my non-MIDlet class.

A penpal of mine who is a very experienced programmer and lives in Deutscheland (not far from where my car was made) gave me some very helpful tips(Hi Frank). Now I've broken out my non-MIDlet classes into separate source files and made them public. That allowed me to get my timestamp data back into the MIDlet to display.

The other problem that I had was that I was not initializing my array of longs correctly. I was using the array as a sequence of timestamps, longs that are Epoch time.

By looking at these times I was able to find a call that took over 2 seconds. I have moved that code to a place before the recording loop starts in hopes of only having to do it once. However, the RecordControl and Player API aren't responding correctly yet.

The idea is to record for about 200 or 300 ms, then hand off the data to the http POST thread, and loop on this until told to stop.

So far the performance has been great, things are working in terms of tens of milliseconds. But there is still not something right with the RecordControl/Player sequence.

I'm glad to have a couple of gurus now that I can bug when I get stuck! It's a great gift.

No comments: