| Reply | « Previous Thread | Next Thread » |
|
Hi,
I have a MIDlet that records short audio segments using RecordControl. Each segment is 1-8 seconds. It works fine for between 7 and 20 minutes, but then crashes. Usually it crashes with no exception (even though I tried to catch all exceptions and errors), sometimes RecordControl.commit() fails with an IOException that reports "commit failed: -4". But it never can record for more than about 20 minutes. I tried this with both a player and RecordControl that exist all the time but are started and stopped, and with new instances of Player and RecordControl for each recording. The MIDlet does not run out of memory; I call gc() after every recording and show free memory on the screen, and it is not going down. The recording is into a ByteArrayOutputStream. To test this failure, I removed all uses of the actual audio, but it still crashes. I do not get these crashes if I record for a few seconds, then let the MIDlet run forever in a loop. The recocrding is into 8000 samples/s PCM, 1 channel. I do get usable WAV files as long as the MIDlet is running. Thanks, Sivan |
| sivan.toledo@gmail.com |
| View Public Profile |
| Find all posts by sivan.toledo@gmail.com |
|
Well, I just wanted to say I have the same problem:)
Ive also tried catching the IOException and then creating a new Player and RecordController, but I still get the same error. Even in a new Thread. Have you found a solution, Id be glad to hear it. By the way my phone is a Nokia 6220. Cheers |
|
Hi Sivan,
Each Player has upper limit for recording at once(in your case 20 min). Recording is not only thing going on behind the scene. In fact, 20 mins of recording is a huge amount of data. Though you have called gc(), it will not execute Garbage collector immediately. Ideally, GC is called whenever the processor is free. OutOfMemorryError seems to be the only culprit for the app crash. You should use multiple players for larger recording. You will observe minor glitches during player switching, but it will definitely solve the crash. Regards, Bharat. |
| bharatpatel85 |
| View Public Profile |
| Find all posts by bharatpatel85 |
|
Thank you for your answer Bahrat (even if it wasnt directly to me)
I do use multiple players and still get the same error with ALOT of free memory 600k of 800k total. Ive tried with gc() and Thread.yield() but it still produces the same error. The below loop works for some 20 minutes and then fails throwing java.io.IOException: failed -4 After this, no recording can be made (Without commit giving the exception) until Midlet is restarted. /** * To allow for a certain amount of exceptions when recording. * So that this thread doesnt die to easily */ int occurredNrExceptions = 0; try { while (true) { ByteArrayOutputStream baos; // Lets allow for n-time IOExceptions try { baos = new ByteArrayOutputStream(); p = Manager.createPlayer("capture://audio); p.realize(); p.prefetch(); // Get the RecordControl, set the record stream, rc = (RecordControl) p.getControl("RecordControl"); rc.setRecordStream(baos); rc.startRecord(); p.start(); Thread.sleep(3000); rc.stopRecord(); rc.commit(); p.stop(); p.close(); } catch (IOException ex) { if (occurredNrExceptions++ < allowedNrException) { try{ p.deallocate(); p.close(); }catch(IllegalStateException ise){ // player was allready closed, DO NOTHING } continue; } else throw ex; occurredNrExceptions = 0; // Use data in baos ... } Please help if you know this! Could this be devicespecefic bugs?
Last edited by lud3e : 2008-09-09 at 15:10.
|
|
Dear Nokia.
This issue has not been resolved and its also noted as "Audio capture crashes 6600" http://discussion.forum.nokia.com/fo...ad.php?t=51875 which means at least 3 phones, my "6220 Classic", N80 and 6600 are affected. Please if someone who works with Nokias java implementation could address this issue. (Or other who knows the answer) Is this a Nokia cross-model bug or is there a way of resetting Manager when this happens. Kind Regards Ludvig Derning |
|
+1
I have the same issue after several minutes while I record 1 second in a loop on a N95 8 Go. Help is clearly needed if someone has succeeded to fix that, I will be happy. |
| n.maisonneuve |
| View Public Profile |
| Find all posts by n.maisonneuve |
|
Quote:
Does someone find a solution to this pb? |
| n.maisonneuve |
| View Public Profile |
| Find all posts by n.maisonneuve |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| N80 midlet icon problem revisited... questions | kounapuu | Mobile Java General | 1 | 2006-10-07 21:15 |
| N80 MIDlet installation problem | klapio | General Discussion | 3 | 2006-08-29 15:53 |
| Audio capture crashes 6600 | cforstner | Mobile Java Media (Graphics & Sounds) | 1 | 2005-09-22 18:28 |
| REcording Audio with 3650 | derdasser | Mobile Java Media (Graphics & Sounds) | 0 | 2005-02-23 21:01 |
| Audio in VIDEO PLAYING in midlet | rossottom | Mobile Java Media (Graphics & Sounds) | 0 | 2003-05-13 18:08 |