* Changed the latency computation a bit to make it somewhat clearer.
* Only report lateness if it is beyond the accepted jitter. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36205 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -90,6 +90,9 @@ multi_audio_format_specialize(media_multi_audio_format *format,
|
|||||||
const static bigtime_t kMaxLatency = 150000;
|
const static bigtime_t kMaxLatency = 150000;
|
||||||
// 150 ms is the maximum latency we publish
|
// 150 ms is the maximum latency we publish
|
||||||
|
|
||||||
|
const bigtime_t kMinMixingTime = 3500;
|
||||||
|
const bigtime_t kMaxJitter = 1500;
|
||||||
|
|
||||||
|
|
||||||
AudioMixer::AudioMixer(BMediaAddOn *addOn, bool isSystemMixer)
|
AudioMixer::AudioMixer(BMediaAddOn *addOn, bool isSystemMixer)
|
||||||
:
|
:
|
||||||
@@ -311,7 +314,7 @@ AudioMixer::BufferReceived(BBuffer *buffer)
|
|||||||
void
|
void
|
||||||
AudioMixer::HandleInputBuffer(BBuffer* buffer, bigtime_t lateness)
|
AudioMixer::HandleInputBuffer(BBuffer* buffer, bigtime_t lateness)
|
||||||
{
|
{
|
||||||
if (lateness > 0) {
|
if (lateness > kMaxJitter) {
|
||||||
debug_printf("Received buffer %Ld usec late\n", lateness);
|
debug_printf("Received buffer %Ld usec late\n", lateness);
|
||||||
if (RunMode() == B_DROP_DATA || RunMode() == B_DECREASE_PRECISION
|
if (RunMode() == B_DROP_DATA || RunMode() == B_DECREASE_PRECISION
|
||||||
|| RunMode() == B_INCREASE_LATENCY) {
|
|| RunMode() == B_INCREASE_LATENCY) {
|
||||||
@@ -907,8 +910,9 @@ AudioMixer::Connect(status_t error, const media_source &source,
|
|||||||
TRACE("AudioMixer: buffer duration is %Ld usecs\n", BufferDuration());
|
TRACE("AudioMixer: buffer duration is %Ld usecs\n", BufferDuration());
|
||||||
|
|
||||||
// Our internal latency is at least the length of a full output buffer
|
// Our internal latency is at least the length of a full output buffer
|
||||||
|
// plus mixing time, plus jitter
|
||||||
fInternalLatency = BufferDuration()
|
fInternalLatency = BufferDuration()
|
||||||
+ max(4500LL, bigtime_t(0.5 * BufferDuration()));
|
+ max(kMinMixingTime, bigtime_t(0.5 * BufferDuration())) + kMaxJitter;
|
||||||
TRACE("AudioMixer: Internal latency is %Ld usecs\n", fInternalLatency);
|
TRACE("AudioMixer: Internal latency is %Ld usecs\n", fInternalLatency);
|
||||||
|
|
||||||
SetEventLatency(fDownstreamLatency + fInternalLatency);
|
SetEventLatency(fDownstreamLatency + fInternalLatency);
|
||||||
|
|||||||
Reference in New Issue
Block a user