Rockbox Technical Forums

Support and General Use => Recording => Topic started by: painless-shadow on December 08, 2006, 11:48:38 AM

Title: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: painless-shadow on December 08, 2006, 11:48:38 AM
Hi,
I'm using the iaudio x5 December 5th build and when I try to enter the Recording Screen while music is playing or paused (but not stopped), the machine freezes.
This happens on several different settings (such as different encoders, channels and etc.).
Needless to say, after stopping whatever is playing, everything is fine.

I was wondering if this is a known issue and is if it a bug?
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: Davide-NYC on December 08, 2006, 12:00:17 PM
I can confirm that this does not happen on a H120.
(maybe helpful, maybe not)
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: petur on December 08, 2006, 12:36:32 PM
also not reproducable on h3x0.

*looks at jhMikeS*
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: xlarge on December 08, 2006, 05:39:43 PM
Confirmed; Iaudio X5 (061208-1032) freezes before entering, but after selecting, recording screen when music (mp3 vbr ~224 ~10mb) is paused in wps.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on December 08, 2006, 05:52:42 PM
Hmmm...you can bet I went into the recording screen with voice and audio playing simultaneously a hundred time. I'm also sort of puzzled why players seem to have their own unit-by-unit difficulties.  ???
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: painless-shadow on January 20, 2007, 06:27:31 AM
Update:
I've installed the daily build from January 13th, and noticed a small change-
Now the Iaudio doesn't freeze on entering the recording screen, but it's only an allusion. If I don't stop the music (i.e. it's either playing or paused), though I can hear the input, the meters aren't responding and if I press record or exit it freezes completely.
I should notice that upon entering the screen, and before pressing either record or exit, I can still change the Volume and Gain options. After it freezes, no key is responding, obviously, but I can still hear the input.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on January 20, 2007, 12:16:14 PM
I'd love to test this out. Should be getting the x5 back soon they say. I never did experience this except when writing the code and I guess I'll mention again I tested that explicitly to make sure it didn't happen. Not sure what changed or why it should only be the iAudio and not the iRiver models too but timing differences could be it within playback.c. There is a bug I know about in playback.c and haven't fixed yet re: the first audio buffer init...could be it too. So long as I can duplicate this it should be fixable.

It sounds like it's getting stuck during loading the encoder somehow. The audio heard is just the monitoring which doesn't involve the recording code.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: ion on March 03, 2007, 04:42:50 AM
I have the same problem. I frequently update rockbox and yesterday i uploaded the latest build but when i entered the recording screen rockbox stopped responding again. I don't know what does it depends on. Sometimes it works but sometimes not.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 12:32:13 PM
I have been able to test and x5 does have some quirks. I've not had a full freeze right offbut have seen the peakmeters run very slow and it's rather unresponsive. It's like something is looping around somewhere and hogging all the CPU. Trying to record under those conditions just makes it so it cannot flush. Atm I have no idea. I did have it lock _after_ the slowdown occurred.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: hailtothethieves on March 03, 2007, 03:15:30 PM
Thought I'd add my piece here: I am able to reproduce the freeze just as painless-shadow described (using Feb 27 build, I think) - no slow meters (no meters at all, in fact). I'm also unable to turn unit off when this happens - the only way I'm able to turn it off is either by resetting or putting it into hold mode (for which I've configured to shut LCD down) and quickly switching it off. If I wait too much on the middle "on" state, no shutting down either.

Thank you =)
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 04:16:39 PM
You should be able to hold the on switch for 1 second and 8 seconds later it should be forced off. You might have to do it twice as the 8 second timeout is stopped on the first press in order to give rb all the time it needs to shut down gracefully.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 04:23:02 PM
So you have a backlight that is responding to the hold key? I ask since I usually use the lack of backlight activity as an indicator of a hard freeze which means the hardware has completely locked or halted. If the backlight remains active in any way (hold key or timeout), it's probably a threading issue.

I should say too that I've had my H120 freeze on recording when a backlight fade starts. Don't know if there's any common issue. I will look into this further in about five minutes.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 04:31:25 PM
Ok, was playing music, entered the screen, no lock. When to the recording menu via the recording screen...noticed that the source option is no longer displayed...started to select menu items and it locked. Backlight was still operating however so the lock was likely software. Two 1s power key presses invoked the emergency shutoff as expected.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 05:01:46 PM
Ok, will keep reporting observations as I make them be prepared for a litany of posts. :)

1) If I enter the recording screen when music is playing, I get a lock when trying to leave it with any souce selected but FMRadio. Usually the peakmeters are not operating even if the screen continues to accept input. This indicates that DMA is not being started for recording properly. The UI thread must still be working though or selecting volume and such would not be possible.

2) If I enter the recording screen without music playing, no locks occur.

3) Having a voice file present actually seem to stop the lockup (usually it's the other way around with this sort of trouble)

I can do this pretty much every time it seems. This never would have passed my tests since it all worked before committing the recording revisions and voice/no voice was a big issue in debugging. I do not know why x5 picked up so many ticks while I was forced out for awhile.

On Nov 27 and 28 I added some changes that deal with stopping music when the audio buffer is requested or else corruption would result at times. On Dec 05 I committed an opto out change for the H120 which should have no x5 effects. On Dec 06, I made some revisions to DMA handling for the raw pcm portion. One change there lead to DMA stopping prematurely but the cause was identified and fixed quickly.

I think I know what to look at given all that. My x5 was not available for testing by Dec and it seems it has timings different from other players. None of this should be timing dependent so race conditions come to mind (no suprise in the playback.c mess).
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 05:52:27 PM
I'm guessing at this point that the encoder loading never returns for some reason. Since the screen is visible the recording thread initialization has passed through obtaining the buffer. The UI thread is let go just before loading the encoder but will be blocked if the recording thread never returned from setting the recording options when it tries to tell the recording thread to uninitialize recording since the recording thread is busy waiting for the encoder.

That's my best theory and will confirm with some logf debugging and splash screens. Then I'll get to formulating a solution.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 06:43:28 PM
Ok, I just updated the build on the x5 to the lastest svn with root menu and I am not experiencing any of that now. Recording goes straight to the screen and not the menu like it did. I will still continue to look for a race condition in the encoder loading that timing changes may affect. It appeared affected by the amount of yielding to other threads and starting the radio does a number of yields waiting for powerup and tuning.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 06:50:01 PM
Nix that. Having splash screens with no timeout was enough to change things. Removing those brought it back. Last time I checked, they don't yield internally with a timeout of 0 so ???.

Probably more message to come...will get to the bottom of this.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 07:09:11 PM
Yup, it's official. The encoder codec is terminated "normally" by the audio_stop. Now to fix it.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: jhMikeS on March 03, 2007, 11:21:23 PM
So go try doing it on the latest builds 04 Mar 04:16 and later. Just committed it and it's still building.
Title: Re: BUG? RB freezing when entering Recording Screen while music is not stopped
Post by: hailtothethieves on March 04, 2007, 08:02:35 AM
Works perfectly now! Thank you very much =)