add stats for skipped streams

This commit is contained in:
Stephen Birarda 2018-09-05 12:06:58 -07:00
parent dacf343e9a
commit 996e033dee
4 changed files with 21 additions and 4 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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

View file

@ -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