mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
time mix instead of throttle with HIFI_AUDIO_MIXER_DEBUG
This commit is contained in:
parent
ee699d3fa6
commit
553fffd8ae
4 changed files with 19 additions and 20 deletions
|
@ -315,8 +315,8 @@ void AudioMixer::sendStatsPacket() {
|
|||
addTiming(_mixTiming, "mix");
|
||||
addTiming(_eventsTiming, "events");
|
||||
|
||||
#ifdef HIFI_AUDIO_THROTTLE_DEBUG
|
||||
timingStats["ns_per_throttle"] = (_stats.totalMixes > 0) ? (float)(_stats.throttleTime / _stats.totalMixes) : 0;
|
||||
#ifdef HIFI_AUDIO_MIXER_DEBUG
|
||||
timingStats["ns_per_mix"] = (_stats.totalMixes > 0) ? (float)(_stats.mixTime / _stats.totalMixes) : 0;
|
||||
#endif
|
||||
|
||||
// call it "avg_..." to keep it higher in the display, sorted alphabetically
|
||||
|
|
|
@ -133,6 +133,10 @@ bool AudioMixerSlave::prepareMix(const SharedNodePointer& listener) {
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef HIFI_AUDIO_MIXER_DEBUG
|
||||
auto mixStart = p_high_resolution_clock::now();
|
||||
#endif
|
||||
|
||||
std::for_each(_begin, _end, [&](const SharedNodePointer& node) {
|
||||
AudioMixerClientData* nodeData = static_cast<AudioMixerClientData*>(node->getLinkedData());
|
||||
if (!nodeData) {
|
||||
|
@ -151,10 +155,6 @@ bool AudioMixerSlave::prepareMix(const SharedNodePointer& listener) {
|
|||
if (!isThrottling) {
|
||||
forAllStreams(node, nodeData, &AudioMixerSlave::mixStream);
|
||||
} else {
|
||||
#ifdef HIFI_AUDIO_THROTTLE_DEBUG
|
||||
auto throttleStart = p_high_resolution_clock::now();
|
||||
#endif
|
||||
|
||||
auto nodeID = node->getUUID();
|
||||
|
||||
// compute the node's max relative volume
|
||||
|
@ -179,13 +179,6 @@ bool AudioMixerSlave::prepareMix(const SharedNodePointer& listener) {
|
|||
if (!throttledNodes.empty()) {
|
||||
std::push_heap(throttledNodes.begin(), throttledNodes.end());
|
||||
}
|
||||
|
||||
#ifdef HIFI_AUDIO_THROTTLE_DEBUG
|
||||
auto throttleEnd = p_high_resolution_clock::now();
|
||||
uint64_t throttleTime =
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(throttleEnd - throttleStart).count();
|
||||
stats.throttleTime += throttleTime;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -215,6 +208,12 @@ bool AudioMixerSlave::prepareMix(const SharedNodePointer& listener) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HIFI_AUDIO_MIXER_DEBUG
|
||||
auto mixEnd = p_high_resolution_clock::now();
|
||||
auto mixTime = std::chrono::duration_cast<std::chrono::nanoseconds>(mixEnd - mixStart);
|
||||
stats.mixTime += mixTime.count();
|
||||
#endif
|
||||
|
||||
// use the per listener AudioLimiter to render the mixed data...
|
||||
listenerData->audioLimiter.render(_mixSamples, _bufferSamples, AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL);
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ void AudioMixerStats::reset() {
|
|||
hrtfThrottleRenders = 0;
|
||||
manualStereoMixes = 0;
|
||||
manualEchoMixes = 0;
|
||||
#ifdef HIFI_AUDIO_THROTTLE_DEBUG
|
||||
throttleTime = 0;
|
||||
#ifdef HIFI_AUDIO_MIXER_DEBUG
|
||||
mixTime = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ void AudioMixerStats::accumulate(const AudioMixerStats& otherStats) {
|
|||
hrtfThrottleRenders += otherStats.hrtfThrottleRenders;
|
||||
manualStereoMixes += otherStats.manualStereoMixes;
|
||||
manualEchoMixes += otherStats.manualEchoMixes;
|
||||
#ifdef HIFI_AUDIO_THROTTLE_DEBUG
|
||||
throttleTime += otherStats.throttleTime;
|
||||
#ifdef HIFI_AUDIO_MIXER_DEBUG
|
||||
mixTime += otherStats.mixTime;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef hifi_AudioMixerStats_h
|
||||
#define hifi_AudioMixerStats_h
|
||||
|
||||
#ifdef HIFI_AUDIO_THROTTLE_DEBUG
|
||||
#ifdef HIFI_AUDIO_MIXER_DEBUG
|
||||
#include <cstdint>
|
||||
#endif
|
||||
|
||||
|
@ -29,8 +29,8 @@ struct AudioMixerStats {
|
|||
int manualStereoMixes { 0 };
|
||||
int manualEchoMixes { 0 };
|
||||
|
||||
#ifdef HIFI_AUDIO_THROTTLE_DEBUG
|
||||
uint64_t throttleTime { 0 };
|
||||
#ifdef HIFI_AUDIO_MIXER_DEBUG
|
||||
uint64_t mixTime { 0 };
|
||||
#endif
|
||||
|
||||
void reset();
|
||||
|
|
Loading…
Reference in a new issue