From f51a77ce45a3a87e81b91a0c9053cf4364a8cab0 Mon Sep 17 00:00:00 2001 From: wangyix Date: Mon, 30 Jun 2014 18:00:29 -0700 Subject: [PATCH] reset the incoming audio seq stats in Application::nodeKilled when audiomixer is killed --- interface/src/Application.cpp | 4 ++++ interface/src/Audio.cpp | 2 ++ interface/src/Audio.h | 1 + 3 files changed, 7 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a032fa7ea0..a024b3f429 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3291,6 +3291,10 @@ void Application::nodeKilled(SharedNodePointer node) { _particleEditSender.nodeKilled(node); _modelEditSender.nodeKilled(node); + if (node->getType() == NodeType::AudioMixer) { + QMetaObject::invokeMethod(&_audio, "resetIncomingMixedAudioSequenceNumberStats"); + } + if (node->getType() == NodeType::VoxelServer) { QUuid nodeUUID = node->getUUID(); // see if this is the first we've heard of this node... diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index c52e2128b0..cda7e2b230 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -121,6 +121,8 @@ void Audio::init(QGLWidget *parent) { void Audio::reset() { _ringBuffer.reset(); _outgoingAvatarAudioSequenceNumber = 0; + _audioMixerInjectedStreamStatsMap.clear(); + _incomingMixedAudioSequenceNumberStats.reset(); } QAudioDeviceInfo getNamedAudioDeviceForMode(QAudio::Mode mode, const QString& deviceName) { diff --git a/interface/src/Audio.h b/interface/src/Audio.h index e6c72f587e..9f04e5cb03 100644 --- a/interface/src/Audio.h +++ b/interface/src/Audio.h @@ -83,6 +83,7 @@ public slots: void addSpatialAudioToBuffer(unsigned int sampleTime, const QByteArray& spatialAudio, unsigned int numSamples); void handleAudioInput(); void reset(); + void resetIncomingMixedAudioSequenceNumberStats() { _incomingMixedAudioSequenceNumberStats.reset(); } void toggleMute(); void toggleAudioNoiseReduction(); void toggleToneInjection();