mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 18:56:22 +02:00
fix audio AppendFlag semantics
This commit is contained in:
parent
dbe3104f09
commit
055fabf57b
3 changed files with 14 additions and 9 deletions
|
@ -218,12 +218,10 @@ void AudioMixerClientData::sendAudioStreamStatsPackets(const SharedNodePointer&
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
// The append flag is a boolean value that will be packed right after the header. The first packet sent
|
// The append flag is a boolean value that will be packed right after the header.
|
||||||
// inside this method will have 0 for this flag, every subsequent packet but the last will have 1 for this flag,
|
|
||||||
// and the last packet will have 2 for this flag.
|
|
||||||
// This flag allows the client to know when it has received all stats packets, so it can group any downstream effects,
|
// This flag allows the client to know when it has received all stats packets, so it can group any downstream effects,
|
||||||
// and clear its cache of injector stream stats; it helps to prevent buildup of dead audio stream stats in the client.
|
// and clear its cache of injector stream stats; it helps to prevent buildup of dead audio stream stats in the client.
|
||||||
quint8 appendFlag = 0;
|
quint8 appendFlag = AudioStreamStats::START;
|
||||||
|
|
||||||
auto streamsCopy = getAudioStreams();
|
auto streamsCopy = getAudioStreams();
|
||||||
|
|
||||||
|
@ -241,12 +239,12 @@ void AudioMixerClientData::sendAudioStreamStatsPackets(const SharedNodePointer&
|
||||||
|
|
||||||
// is this the terminal packet?
|
// is this the terminal packet?
|
||||||
if (numStreamStatsRemaining <= numStreamStatsToPack) {
|
if (numStreamStatsRemaining <= numStreamStatsToPack) {
|
||||||
appendFlag = 2;
|
appendFlag |= AudioStreamStats::END;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pack the append flag in this packet
|
// pack the append flag in this packet
|
||||||
statsPacket->writePrimitive(appendFlag);
|
statsPacket->writePrimitive(appendFlag);
|
||||||
appendFlag = 1;
|
appendFlag = 0;
|
||||||
|
|
||||||
// pack the number of stream stats to follow
|
// pack the number of stream stats to follow
|
||||||
statsPacket->writePrimitive(numStreamStatsToPack);
|
statsPacket->writePrimitive(numStreamStatsToPack);
|
||||||
|
|
|
@ -69,7 +69,7 @@ void AudioIOStats::processStreamStatsPacket(QSharedPointer<ReceivedMessage> mess
|
||||||
quint8 appendFlag;
|
quint8 appendFlag;
|
||||||
message->readPrimitive(&appendFlag);
|
message->readPrimitive(&appendFlag);
|
||||||
|
|
||||||
if (appendFlag == 0) {
|
if (appendFlag & AudioStreamStats::START) {
|
||||||
_injectorStreams.clear();
|
_injectorStreams.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void AudioIOStats::processStreamStatsPacket(QSharedPointer<ReceivedMessage> mess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appendFlag == 2) {
|
if (appendFlag & AudioStreamStats::END) {
|
||||||
_interface->updateInjectorStreams(_injectorStreams);
|
_interface->updateInjectorStreams(_injectorStreams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ void AudioIOStats::publish() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint8 appendFlag = 0;
|
quint8 appendFlag = AudioStreamStats::START | AudioStreamStats::END;
|
||||||
quint16 numStreamStatsToPack = 1;
|
quint16 numStreamStatsToPack = 1;
|
||||||
AudioStreamStats stats = _receivedAudioStream->getAudioStreamStats();
|
AudioStreamStats stats = _receivedAudioStream->getAudioStreamStats();
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,13 @@
|
||||||
|
|
||||||
class AudioStreamStats {
|
class AudioStreamStats {
|
||||||
public:
|
public:
|
||||||
|
// Intermediate packets should have no flag set
|
||||||
|
// Unique packets should have both flags set
|
||||||
|
enum AppendFlag : quint8 {
|
||||||
|
START = 1,
|
||||||
|
END = 2
|
||||||
|
};
|
||||||
|
|
||||||
AudioStreamStats()
|
AudioStreamStats()
|
||||||
: _streamType(-1),
|
: _streamType(-1),
|
||||||
_streamIdentifier(),
|
_streamIdentifier(),
|
||||||
|
|
Loading…
Reference in a new issue