[haiku-bugs] Re: [Haiku] #7285: BSoundPlayer sends buffers late, with ever-increasing latency

  • From: "Pete" <trac@xxxxxxxxxxxx>
  • Date: Mon, 02 May 2011 23:11:49 -0000

#7285: BSoundPlayer sends buffers late, with ever-increasing latency
------------------------------+-----------------------
   Reporter:  Pete            |      Owner:  axeld
       Type:  bug             |     Status:  new
   Priority:  normal          |  Milestone:  R1
  Component:  Kits/Media Kit  |    Version:  R1/alpha2
 Resolution:                  |   Keywords:
 Blocked By:                  |   Blocking:
Has a Patch:  1               |   Platform:  All
------------------------------+-----------------------

Comment (by Pete):

 After a little more tweaking, I think I'm satisfied with the changes to
 AudioMixer, so the patch is attached.

 In summary, the updates are as follows:

 '''MediaEventLooper''':[[BR]]
 In the original, the latency was ''subtracted'' from "now" before checking
 against the first event start time, so that could never be seen as late!
 Latency is now added to the current time as it should be.
 (The actual calculation of "lateness" was at one point moved to that point
 at the beginning of the loop, but it seems better that the true lateness
 when the buffer is returned from the loop be provided, so this check is
 still done after wakeup, as it was originally.)

 '''AudioMixer''':[[BR]]
 Checking the lateness of incoming buffers -- and notifying the producer --
 is now done in BufferReceived, rather than when the buffer is returned
 from the loop in HandleInputBuffer.  There is a new test in the latter for
 actual lateness ( wrt downstream latency -- ''not'' the total event
 latency) which will adjust the Mixer's internal latency.
 LateNoticeReceived will also adjust internal latency, but as far as I can
 tell is never invoked!
 In all cases, lateness is only acted upon if it is an ''initial'' report,
 as multiple buffers following in the queue will also be flagged late.  The
 fLastNotification variable has been redirected for this purpose, as its
 original use in LateNoticeReceived seemed to be pointless.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/7285#comment:11>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: