mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 11:08:06 +02:00
Fix another bug in audio-mixer audio packet parsing.
For SilentAudioFrame packets, numSamples was being read as channel flag.
This commit is contained in:
parent
ad2a031060
commit
c363a9281e
1 changed files with 12 additions and 6 deletions
|
@ -281,15 +281,21 @@ int AudioMixerClientData::parseData(ReceivedMessage& message) {
|
|||
// pull the codec string from the packet
|
||||
auto codecString = message.readString();
|
||||
|
||||
// read the channel flag to see if our stream is stereo or not
|
||||
quint8 channelFlag;
|
||||
message.readPrimitive(&channelFlag);
|
||||
|
||||
bool isStereo = channelFlag == 1;
|
||||
// determine if the stream is stereo or not
|
||||
bool isStereo;
|
||||
if (packetType == PacketType::SilentAudioFrame) {
|
||||
quint16 numSilentSamples;
|
||||
message.readPrimitive(&numSilentSamples);
|
||||
isStereo = numSilentSamples == AudioConstants::NETWORK_FRAME_SAMPLES_STEREO;
|
||||
} else {
|
||||
quint8 channelFlag;
|
||||
message.readPrimitive(&channelFlag);
|
||||
isStereo = channelFlag == 1;
|
||||
}
|
||||
|
||||
auto avatarAudioStream = new AvatarAudioStream(isStereo, AudioMixer::getStaticJitterFrames());
|
||||
avatarAudioStream->setupCodec(_codec, _selectedCodecName, AudioConstants::MONO);
|
||||
qCDebug(audio) << "creating new AvatarAudioStream... codec:" << _selectedCodecName << "channels:" << (channelFlag + 1);
|
||||
qCDebug(audio) << "creating new AvatarAudioStream... codec:" << _selectedCodecName << "channels:" << (isStereo ? 2 : 1);
|
||||
|
||||
connect(avatarAudioStream, &InboundAudioStream::mismatchedAudioCodec,
|
||||
this, &AudioMixerClientData::handleMismatchAudioFormat);
|
||||
|
|
Loading…
Reference in a new issue