• Status Closed
  • Percent Complete
  • Task Type Bugs
  • Category Music playback
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Version 3.3
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Blue_Dude - 2009-06-24
Last edited by kugel. - 2009-06-29

FS#10377 - PCM buffer remainder is played under too many conditions

The pcmbuf_play_remainder() routine in pcmbuf.c was intended to ensure that the last samples were played out of the buffer at the end of the playlist. This was done from a call in playback.c, but the placement of that call causes pcmbuf_play_remainder() to be called for all stops. This caused a subtle bug in another patch that could crash the player under certain conditions.

This patch changes the placement of the call so that it’s only invoked at the end of the playlist as intended.

Closed by  kugel.
2009-06-29 19:21
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Commit the last patch in r21569. Thanks.

Here’s a better patch that does the same thing.

Can you explain the actual bug and change please? what’s the difference between “playing” and “!paused” ?

Yeah, this one was a little weird. The problem was in the changes I made to the pcmbuf_play_remainder() routine in another patch. I added a pcmbuf_request_buffer line to make space at the end of the PCM buffer for the contents of the attack buffer. But during a manual stop, this line would go into an infinite loop waiting on buffer space that wasn’t going to appear, and occasionally crash. So in order to discriminate between a manual stop and playing out to the end I changed the condition from “playing” to “!paused”. A manual stop at this stage is actually paused but still playing, but it doesn’t need the samples because it’s not ever going to play them. But if playing to the very end, it’s not paused and it needs them, so it gets them.

This change as a standalone patch has no ill effects and actually prevents an unneeded call. If it’s not used for now, nothing bad will happen. Consider it a minor cleanup.

Same patch with code commentary.

A short hedge against something strange happening. This routine should never be called if (!playing) and (!paused), but just in case…

Cleaner code.


Available keyboard shortcuts


Task Details

Task Editing