limit maximum latency
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3796 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6c8c941ac3
commit
c378a5ecf8
@ -444,7 +444,7 @@ AudioMixer::FormatChangeRequested(const media_source &source, const media_destin
|
||||
TRACE("AudioMixer: buffer duration is %Ld usecs\n", BufferDuration());
|
||||
|
||||
// Our internal latency is at least the length of a full output buffer
|
||||
fInternalLatency = bigtime_t(1.6 * BufferDuration());
|
||||
fInternalLatency = BufferDuration() + min(4500LL, bigtime_t(0.5 * BufferDuration()));
|
||||
TRACE("AudioMixer: Internal latency is %Ld usecs\n", fInternalLatency);
|
||||
|
||||
SetEventLatency(fDownstreamLatency + fInternalLatency);
|
||||
@ -637,11 +637,10 @@ AudioMixer::Connect(status_t error, const media_source &source, const media_dest
|
||||
|
||||
// SetDuration of one buffer
|
||||
SetBufferDuration(buffer_duration(format.u.raw_audio));
|
||||
|
||||
TRACE("AudioMixer: buffer duration is %Ld usecs\n", BufferDuration());
|
||||
|
||||
// Our internal latency is at least the length of a full output buffer
|
||||
fInternalLatency = bigtime_t(1.6 * BufferDuration());
|
||||
fInternalLatency = BufferDuration() + min(4500LL, bigtime_t(0.5 * BufferDuration()));
|
||||
TRACE("AudioMixer: Internal latency is %Ld usecs\n", fInternalLatency);
|
||||
|
||||
SetEventLatency(fDownstreamLatency + fInternalLatency);
|
||||
|
@ -401,7 +401,8 @@ MixerCore::MixThread()
|
||||
|
||||
if (!LockFromMixThread())
|
||||
return;
|
||||
latency = bigtime_t(0.4 * buffer_duration(fOutput->MediaOutput().format.u.raw_audio));
|
||||
latency = min(3600LL, bigtime_t(0.4 * buffer_duration(fOutput->MediaOutput().format.u.raw_audio)));
|
||||
// XXX we might need to add scheduling latency
|
||||
|
||||
TRACE("MixerCore: starting MixThread at %Ld with latency %Ld and downstream latency %Ld\n", start, latency, fDownstreamLatency);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user