mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-04 12:50:15 +02:00
fixes to silent audio frame sending
This commit is contained in:
parent
9f24bd9c47
commit
61594b9a1e
5 changed files with 12 additions and 9 deletions
|
@ -322,7 +322,8 @@ void AudioMixer::readPendingDatagrams() {
|
||||||
PacketType mixerPacketType = packetTypeForPacket(receivedPacket);
|
PacketType mixerPacketType = packetTypeForPacket(receivedPacket);
|
||||||
if (mixerPacketType == PacketTypeMicrophoneAudioNoEcho
|
if (mixerPacketType == PacketTypeMicrophoneAudioNoEcho
|
||||||
|| mixerPacketType == PacketTypeMicrophoneAudioWithEcho
|
|| mixerPacketType == PacketTypeMicrophoneAudioWithEcho
|
||||||
|| mixerPacketType == PacketTypeInjectAudio) {
|
|| mixerPacketType == PacketTypeInjectAudio
|
||||||
|
|| mixerPacketType == PacketTypeSilentAudioFrame) {
|
||||||
|
|
||||||
nodeList->findNodeAndUpdateWithDataFromPacket(receivedPacket);
|
nodeList->findNodeAndUpdateWithDataFromPacket(receivedPacket);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -41,7 +41,8 @@ AvatarAudioRingBuffer* AudioMixerClientData::getAvatarAudioRingBuffer() const {
|
||||||
int AudioMixerClientData::parseData(const QByteArray& packet) {
|
int AudioMixerClientData::parseData(const QByteArray& packet) {
|
||||||
PacketType packetType = packetTypeForPacket(packet);
|
PacketType packetType = packetTypeForPacket(packet);
|
||||||
if (packetType == PacketTypeMicrophoneAudioWithEcho
|
if (packetType == PacketTypeMicrophoneAudioWithEcho
|
||||||
|| packetType == PacketTypeMicrophoneAudioNoEcho) {
|
|| packetType == PacketTypeMicrophoneAudioNoEcho
|
||||||
|
|| packetType == PacketTypeSilentAudioFrame) {
|
||||||
|
|
||||||
// grab the AvatarAudioRingBuffer from the vector (or create it if it doesn't exist)
|
// grab the AvatarAudioRingBuffer from the vector (or create it if it doesn't exist)
|
||||||
AvatarAudioRingBuffer* avatarRingBuffer = getAvatarAudioRingBuffer();
|
AvatarAudioRingBuffer* avatarRingBuffer = getAvatarAudioRingBuffer();
|
||||||
|
|
|
@ -436,7 +436,7 @@ void Audio::handleAudioInput() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!_noiseGateOpen) {
|
if (!_noiseGateOpen) {
|
||||||
memset(monoAudioSamples, 0, NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
memset(monoAudioSamples, 0, NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL);
|
||||||
_lastInputLoudness = 0;
|
_lastInputLoudness = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ void Audio::handleAudioInput() {
|
||||||
// our input loudness is 0, since we're muted
|
// our input loudness is 0, since we're muted
|
||||||
_lastInputLoudness = 0;
|
_lastInputLoudness = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add procedural effects to the appropriate input samples
|
// add procedural effects to the appropriate input samples
|
||||||
addProceduralSounds(monoAudioSamples,
|
addProceduralSounds(monoAudioSamples,
|
||||||
NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
||||||
|
@ -486,7 +486,7 @@ void Audio::handleAudioInput() {
|
||||||
|
|
||||||
PacketType packetType;
|
PacketType packetType;
|
||||||
if (_lastInputLoudness == 0) {
|
if (_lastInputLoudness == 0) {
|
||||||
packetType = PacketTypeSilentAudioListener;
|
packetType = PacketTypeSilentAudioFrame;
|
||||||
|
|
||||||
// we need to indicate how many silent samples this is to the audio mixer
|
// we need to indicate how many silent samples this is to the audio mixer
|
||||||
monoAudioSamples[0] = NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL;
|
monoAudioSamples[0] = NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL;
|
||||||
|
@ -515,7 +515,7 @@ void Audio::handleAudioInput() {
|
||||||
nodeList->writeDatagram(monoAudioDataPacket, numAudioBytes + leadingBytes, audioMixer);
|
nodeList->writeDatagram(monoAudioDataPacket, numAudioBytes + leadingBytes, audioMixer);
|
||||||
|
|
||||||
Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::AUDIO)
|
Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::AUDIO)
|
||||||
.updateValue(NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes);
|
.updateValue(numAudioBytes + leadingBytes);
|
||||||
}
|
}
|
||||||
delete[] inputAudioSamples;
|
delete[] inputAudioSamples;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,12 @@ int PositionalAudioRingBuffer::parseData(const QByteArray& packet) {
|
||||||
|
|
||||||
packetStream.skipRawData(parsePositionalData(packet.mid(packetStream.device()->pos())));
|
packetStream.skipRawData(parsePositionalData(packet.mid(packetStream.device()->pos())));
|
||||||
|
|
||||||
if (packetTypeForPacket(packet) == PacketTypeSilentAudioListener) {
|
if (packetTypeForPacket(packet) == PacketTypeSilentAudioFrame) {
|
||||||
// this source had no audio to send us, but this counts as a packet
|
// this source had no audio to send us, but this counts as a packet
|
||||||
// write silence equivalent to the number of silent samples they just sent us
|
// write silence equivalent to the number of silent samples they just sent us
|
||||||
int16_t numSilentSamples;
|
int16_t numSilentSamples;
|
||||||
packetStream >> numSilentSamples;
|
packetStream.readRawData(reinterpret_cast<char*>(&numSilentSamples), sizeof(int16_t));
|
||||||
|
|
||||||
addSilentFrame(numSilentSamples);
|
addSilentFrame(numSilentSamples);
|
||||||
} else {
|
} else {
|
||||||
// there is audio data to read
|
// there is audio data to read
|
||||||
|
|
|
@ -32,7 +32,7 @@ enum PacketType {
|
||||||
PacketTypeMicrophoneAudioNoEcho,
|
PacketTypeMicrophoneAudioNoEcho,
|
||||||
PacketTypeMicrophoneAudioWithEcho,
|
PacketTypeMicrophoneAudioWithEcho,
|
||||||
PacketTypeBulkAvatarData,
|
PacketTypeBulkAvatarData,
|
||||||
PacketTypeSilentAudioListener,
|
PacketTypeSilentAudioFrame,
|
||||||
PacketTypeEnvironmentData,
|
PacketTypeEnvironmentData,
|
||||||
PacketTypeDomainListRequest,
|
PacketTypeDomainListRequest,
|
||||||
PacketTypeRequestAssignment,
|
PacketTypeRequestAssignment,
|
||||||
|
|
Loading…
Reference in a new issue