[haiku-commits] haiku: hrev50042 - src/add-ons/media/media-add-ons/mixer

  • From: b.vitruvio@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 19 Jan 2016 22:51:34 +0100 (CET)

hrev50042 adds 2 changesets to branch 'master'
old head: b64e8511cdfaa0e99d35c66338fba97e9c438c1e
new head: 08a65695bb4f117688eb9a008c63e66ff6a1493c
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=08a65695bb4f+%5Eb64e8511cdfa

----------------------------------------------------------------------------

1fe3cb874245: 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.

08a65695bb4f: AudioMixer: Replace debug_printf with TRACE

                                [ Dario Casalinuovo <b.vitruvio@xxxxxxxxx> ]

----------------------------------------------------------------------------

1 file changed, 11 insertions(+), 6 deletions(-)
.../media/media-add-ons/mixer/AudioMixer.cpp        | 17 +++++++++++------

############################################################################

Commit:      1fe3cb8742458662adcca7e6b43440196ec1c60c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1fe3cb874245
Author:      Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
Date:        Tue Jan 19 21:25:45 2016 UTC

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.

----------------------------------------------------------------------------

diff --git a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp 
b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp
index f532179..5d0060a 100644
--- a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp
+++ b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp
@@ -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();

############################################################################

Revision:    hrev50042
Commit:      08a65695bb4f117688eb9a008c63e66ff6a1493c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=08a65695bb4f
Author:      Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
Date:        Tue Jan 19 21:32:32 2016 UTC

AudioMixer: Replace debug_printf with TRACE

----------------------------------------------------------------------------

diff --git a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp 
b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp
index 5d0060a..1af6a4d 100644
--- a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp
+++ b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp
@@ -326,11 +326,11 @@ AudioMixer::HandleInputBuffer(BBuffer* buffer, bigtime_t 
lateness)
                variation = lateness-fLastLateness;
 
        if (variation > kMaxJitter) {
-               debug_printf("AudioMixer: Dequeued input buffer %" B_PRIdBIGTIME
+               TRACE("AudioMixer: Dequeued input buffer %" B_PRIdBIGTIME
                        " usec late\n", lateness);
                if (RunMode() == B_DROP_DATA || RunMode() == 
B_DECREASE_PRECISION
                        || RunMode() == B_INCREASE_LATENCY) {
-                       debug_printf("AudioMixer: sending notify\n");
+                       TRACE("AudioMixer: sending notify\n");
 
                        // Build a media_source out of the header data
                        media_source source = media_source::null;
@@ -340,7 +340,7 @@ AudioMixer::HandleInputBuffer(BBuffer* buffer, bigtime_t 
lateness)
                        NotifyLateProducer(source, variation, 
TimeSource()->Now());
 
                        if (RunMode() == B_DROP_DATA) {
-                               debug_printf("AudioMixer: dropping buffer\n");
+                               TRACE("AudioMixer: dropping buffer\n");
                                return;
                        }
                }
@@ -1043,7 +1043,7 @@ AudioMixer::LateNoticeReceived(const media_source& what, 
bigtime_t howMuch,
 
                fLastLateNotification = TimeSource()->Now() + howMuch;
 
-               debug_printf("AudioMixer: increasing internal latency to %"
+               TRACE("AudioMixer: increasing internal latency to %"
                        B_PRIdBIGTIME " usec\n", fInternalLatency);
                SetEventLatency(fDownstreamLatency + fInternalLatency);
 


Other related posts:

  • » [haiku-commits] haiku: hrev50042 - src/add-ons/media/media-add-ons/mixer - b . vitruvio