From 996e033deeb25d43f2c76ab61358420a266995e0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 5 Sep 2018 12:06:58 -0700 Subject: [PATCH] add stats for skipped streams --- assignment-client/src/audio/AudioMixer.cpp | 3 +++ assignment-client/src/audio/AudioMixerSlave.cpp | 11 +++++++---- assignment-client/src/audio/AudioMixerStats.cpp | 7 +++++++ assignment-client/src/audio/AudioMixerStats.h | 4 ++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/assignment-client/src/audio/AudioMixer.cpp b/assignment-client/src/audio/AudioMixer.cpp index ce0ecd8e37..8c9a202844 100644 --- a/assignment-client/src/audio/AudioMixer.cpp +++ b/assignment-client/src/audio/AudioMixer.cpp @@ -302,6 +302,9 @@ void AudioMixer::sendStatsPacket() { mixStats["%_hrtf_mixes"] = percentageForMixStats(_stats.hrtfRenders); mixStats["%_hrtf_silent_mixes"] = percentageForMixStats(_stats.hrtfSilentRenders); mixStats["%_hrtf_throttle_mixes"] = percentageForMixStats(_stats.hrtfThrottleRenders); + mixStats["%_skipped_throttle_mixes"] = percentageForMixStats(_stats.skippedThrottle); + mixStats["%_skipped_silent_mixes"] = percentageForMixStats(_stats.skippedSilent); + mixStats["%_skipped_other_mixes"] = percentageForMixStats(_stats.skippedOther); mixStats["%_manual_stereo_mixes"] = percentageForMixStats(_stats.manualStereoMixes); mixStats["%_manual_echo_mixes"] = percentageForMixStats(_stats.manualEchoMixes); diff --git a/assignment-client/src/audio/AudioMixerSlave.cpp b/assignment-client/src/audio/AudioMixerSlave.cpp index f2afe000d9..9d2f3728a5 100644 --- a/assignment-client/src/audio/AudioMixerSlave.cpp +++ b/assignment-client/src/audio/AudioMixerSlave.cpp @@ -347,6 +347,7 @@ void AudioMixerSlave::addStream(AudioMixerClientData::MixableStream& mixableStre if (mixableStream.skippedStream) { // any skipped stream gets no processing and no silent render - early return + ++stats.skippedOther; return; } @@ -357,11 +358,13 @@ void AudioMixerSlave::addStream(AudioMixerClientData::MixableStream& mixableStre // to reduce artifacts we still call the HRTF functor for every silent or throttled source // for the first frame where the source becomes throttled or silent // this ensures the correct tail from last mixed block and the correct spatialization of next first block - if (throttle || mixableStream.skippedStream || streamToAdd->getLastPopOutputLoudness() == 0.0f) { + if (throttle || streamToAdd->getLastPopOutputLoudness() == 0.0f) { if (mixableStream.completedSilentRender) { - if (throttle) { - ++stats.hrtfThrottleRenders; + if (streamToAdd->getLastPopOutputLoudness() == 0.0f) { + ++stats.skippedSilent; + } else { + ++stats.skippedThrottle; } return; @@ -456,7 +459,7 @@ void AudioMixerSlave::addStream(AudioMixerClientData::MixableStream& mixableStre streamPopOutput.readSamples(_bufferSamples, AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL); - if (streamToAdd->getLastPopOutputLoudness() == 0.0f || mixableStream.skippedStream) { + if (streamToAdd->getLastPopOutputLoudness() == 0.0f) { // call renderSilent to reduce artifacts mixableStream.hrtf->renderSilent(_bufferSamples, _mixSamples, HRTF_DATASET_INDEX, azimuth, distance, gain, AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL); diff --git a/assignment-client/src/audio/AudioMixerStats.cpp b/assignment-client/src/audio/AudioMixerStats.cpp index 4cfdd55167..213c0ba5e6 100644 --- a/assignment-client/src/audio/AudioMixerStats.cpp +++ b/assignment-client/src/audio/AudioMixerStats.cpp @@ -21,6 +21,9 @@ void AudioMixerStats::reset() { hrtfThrottleRenders = 0; manualStereoMixes = 0; manualEchoMixes = 0; + skippedThrottle = 0; + skippedSilent = 0; + skippedOther = 0; #ifdef HIFI_AUDIO_MIXER_DEBUG mixTime = 0; #endif @@ -36,6 +39,10 @@ void AudioMixerStats::accumulate(const AudioMixerStats& otherStats) { hrtfThrottleRenders += otherStats.hrtfThrottleRenders; manualStereoMixes += otherStats.manualStereoMixes; manualEchoMixes += otherStats.manualEchoMixes; + skippedThrottle += otherStats.skippedThrottle; + skippedSilent += otherStats.skippedSilent; + skippedOther += otherStats.skippedOther; + #ifdef HIFI_AUDIO_MIXER_DEBUG mixTime += otherStats.mixTime; #endif diff --git a/assignment-client/src/audio/AudioMixerStats.h b/assignment-client/src/audio/AudioMixerStats.h index f4ba9db769..41eb295214 100644 --- a/assignment-client/src/audio/AudioMixerStats.h +++ b/assignment-client/src/audio/AudioMixerStats.h @@ -30,6 +30,10 @@ struct AudioMixerStats { int manualStereoMixes { 0 }; int manualEchoMixes { 0 }; + int skippedThrottle { 0 }; + int skippedSilent { 0 }; + int skippedOther { 0 }; + #ifdef HIFI_AUDIO_MIXER_DEBUG uint64_t mixTime { 0 }; #endif