From f0ca412b29b3cf77fdd5b4d73db53a334a313abd Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 10 Feb 2016 18:22:57 -0800 Subject: [PATCH 1/2] use the existing not mixed count for injector inactivity --- .../src/audio/AudioMixerClientData.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/assignment-client/src/audio/AudioMixerClientData.cpp b/assignment-client/src/audio/AudioMixerClientData.cpp index fa706eb0f6..944ffc382a 100644 --- a/assignment-client/src/audio/AudioMixerClientData.cpp +++ b/assignment-client/src/audio/AudioMixerClientData.cpp @@ -157,12 +157,16 @@ void AudioMixerClientData::checkBuffersBeforeFrameSend() { while (it != _audioStreams.end()) { SharedStreamPointer stream = it->second; - static const int INJECTOR_INACTIVITY_USECS = 5 * USECS_PER_SECOND; + if (stream->popFrames(1, true) > 0) { + stream->updateLastPopOutputLoudnessAndTrailingLoudness(); + } + + static const int INJECTOR_MAX_INACTIVE_BLOCKS = 500; // if we don't have new data for an injected stream in the last INJECTOR_INACTIVITY_MSECS then // we remove the injector from our streams if (stream->getType() == PositionalAudioStream::Injector - && stream->usecsSinceLastPacket() > INJECTOR_INACTIVITY_USECS) { + && stream->getConsecutiveNotMixedCount() > INJECTOR_MAX_INACTIVE_BLOCKS) { // this is an inactive injector, pull it from our streams // first emit that it is finished so that the HRTF objects for this source can be cleaned up @@ -170,12 +174,8 @@ void AudioMixerClientData::checkBuffersBeforeFrameSend() { // erase the stream to drop our ref to the shared pointer and remove it it = _audioStreams.erase(it); - + } else { - if (stream->popFrames(1, true) > 0) { - stream->updateLastPopOutputLoudnessAndTrailingLoudness(); - } - ++it; } } From 367e558b19963d9fb3b0646f30dab23966704e4d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 11 Feb 2016 09:30:07 -0800 Subject: [PATCH 2/2] address PR comments for whitespace and constant --- assignment-client/src/audio/AudioMixerClientData.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/assignment-client/src/audio/AudioMixerClientData.cpp b/assignment-client/src/audio/AudioMixerClientData.cpp index 944ffc382a..38cb8a174f 100644 --- a/assignment-client/src/audio/AudioMixerClientData.cpp +++ b/assignment-client/src/audio/AudioMixerClientData.cpp @@ -163,7 +163,7 @@ void AudioMixerClientData::checkBuffersBeforeFrameSend() { static const int INJECTOR_MAX_INACTIVE_BLOCKS = 500; - // if we don't have new data for an injected stream in the last INJECTOR_INACTIVITY_MSECS then + // if we don't have new data for an injected stream in the last INJECTOR_MAX_INACTIVE_BLOCKS then // we remove the injector from our streams if (stream->getType() == PositionalAudioStream::Injector && stream->getConsecutiveNotMixedCount() > INJECTOR_MAX_INACTIVE_BLOCKS) { @@ -174,7 +174,6 @@ void AudioMixerClientData::checkBuffersBeforeFrameSend() { // erase the stream to drop our ref to the shared pointer and remove it it = _audioStreams.erase(it); - } else { ++it; }