• 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 Jeffrey Goode - 2009-06-24
Last edited by Thomas Martitz - 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  Thomas Martitz
2009-06-29 19:21
Reason for closing:  Accepted
Additional comments about closing:  

Commit the last patch in r21569. Thanks.

Jeffrey Goode commented on 2009-06-24 15:25

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

Thomas Martitz commented on 2009-06-25 10:02

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

Jeffrey Goode commented on 2009-06-25 12:55

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.

Jeffrey Goode commented on 2009-06-26 18:41

Same patch with code commentary.

Jeffrey Goode commented on 2009-06-26 18:46

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

Jeffrey Goode commented on 2009-06-26 18:56

Cleaner code.


Available keyboard shortcuts


Task Details

Task Editing