AudioMixer: Notify the producer basing on latency variation
* Since the producer may take an undefined amount of buffers to process the latency increase, possibly depending on it's queue, the consumer will notify only the difference between the old latency and the new. While not solving completely, this improves the situation under virtual box (and slow systems) making the sound more stable.
This commit is contained in:
@@ -321,7 +321,11 @@ AudioMixer::BufferReceived(BBuffer *buffer)
|
||||
void
|
||||
AudioMixer::HandleInputBuffer(BBuffer* buffer, bigtime_t lateness)
|
||||
{
|
||||
if (lateness > kMaxJitter && lateness > fLastLateness) {
|
||||
bigtime_t variation = 0;
|
||||
if (lateness > fLastLateness)
|
||||
variation = lateness-fLastLateness;
|
||||
|
||||
if (variation > kMaxJitter) {
|
||||
debug_printf("AudioMixer: Dequeued input buffer %" B_PRIdBIGTIME
|
||||
" usec late\n", lateness);
|
||||
if (RunMode() == B_DROP_DATA || RunMode() == B_DECREASE_PRECISION
|
||||
@@ -333,7 +337,7 @@ AudioMixer::HandleInputBuffer(BBuffer* buffer, bigtime_t lateness)
|
||||
source.port = buffer->Header()->source_port;
|
||||
source.id = buffer->Header()->source;
|
||||
|
||||
NotifyLateProducer(source, lateness, TimeSource()->Now());
|
||||
NotifyLateProducer(source, variation, TimeSource()->Now());
|
||||
|
||||
if (RunMode() == B_DROP_DATA) {
|
||||
debug_printf("AudioMixer: dropping buffer\n");
|
||||
@@ -341,6 +345,7 @@ AudioMixer::HandleInputBuffer(BBuffer* buffer, bigtime_t lateness)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fLastLateness = lateness;
|
||||
|
||||
fCore->Lock();
|
||||
|
||||
Reference in New Issue
Block a user