mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:36:47 +02:00
Enable stereo codecs for AvatarAudioStream
This commit is contained in:
parent
660032d8fb
commit
6a2e3cc272
2 changed files with 8 additions and 7 deletions
|
@ -283,7 +283,8 @@ int AudioMixerClientData::parseData(ReceivedMessage& message) {
|
||||||
|
|
||||||
// determine if the stream is stereo or not
|
// determine if the stream is stereo or not
|
||||||
bool isStereo;
|
bool isStereo;
|
||||||
if (packetType == PacketType::SilentAudioFrame) {
|
if (packetType == PacketType::SilentAudioFrame
|
||||||
|
|| packetType == PacketType::ReplicatedSilentAudioFrame) {
|
||||||
quint16 numSilentSamples;
|
quint16 numSilentSamples;
|
||||||
message.readPrimitive(&numSilentSamples);
|
message.readPrimitive(&numSilentSamples);
|
||||||
isStereo = numSilentSamples == AudioConstants::NETWORK_FRAME_SAMPLES_STEREO;
|
isStereo = numSilentSamples == AudioConstants::NETWORK_FRAME_SAMPLES_STEREO;
|
||||||
|
@ -294,8 +295,8 @@ int AudioMixerClientData::parseData(ReceivedMessage& message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto avatarAudioStream = new AvatarAudioStream(isStereo, AudioMixer::getStaticJitterFrames());
|
auto avatarAudioStream = new AvatarAudioStream(isStereo, AudioMixer::getStaticJitterFrames());
|
||||||
avatarAudioStream->setupCodec(_codec, _selectedCodecName, AudioConstants::MONO);
|
avatarAudioStream->setupCodec(_codec, _selectedCodecName, isStereo ? AudioConstants::STEREO : AudioConstants::MONO);
|
||||||
qCDebug(audio) << "creating new AvatarAudioStream... codec:" << _selectedCodecName << "channels:" << (isStereo ? 2 : 1);
|
qCDebug(audio) << "creating new AvatarAudioStream... codec:" << _selectedCodecName << "isStereo:" << isStereo;
|
||||||
|
|
||||||
connect(avatarAudioStream, &InboundAudioStream::mismatchedAudioCodec,
|
connect(avatarAudioStream, &InboundAudioStream::mismatchedAudioCodec,
|
||||||
this, &AudioMixerClientData::handleMismatchAudioFormat);
|
this, &AudioMixerClientData::handleMismatchAudioFormat);
|
||||||
|
@ -334,7 +335,7 @@ int AudioMixerClientData::parseData(ReceivedMessage& message) {
|
||||||
|
|
||||||
#if INJECTORS_SUPPORT_CODECS
|
#if INJECTORS_SUPPORT_CODECS
|
||||||
injectorStream->setupCodec(_codec, _selectedCodecName, isStereo ? AudioConstants::STEREO : AudioConstants::MONO);
|
injectorStream->setupCodec(_codec, _selectedCodecName, isStereo ? AudioConstants::STEREO : AudioConstants::MONO);
|
||||||
qCDebug(audio) << "creating new injectorStream... codec:" << _selectedCodecName;
|
qCDebug(audio) << "creating new injectorStream... codec:" << _selectedCodecName << "isStereo:" << isStereo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto emplaced = _audioStreams.emplace(
|
auto emplaced = _audioStreams.emplace(
|
||||||
|
@ -577,7 +578,7 @@ void AudioMixerClientData::setupCodec(CodecPluginPointer codec, const QString& c
|
||||||
|
|
||||||
auto avatarAudioStream = getAvatarAudioStream();
|
auto avatarAudioStream = getAvatarAudioStream();
|
||||||
if (avatarAudioStream) {
|
if (avatarAudioStream) {
|
||||||
avatarAudioStream->setupCodec(codec, codecName, AudioConstants::MONO);
|
avatarAudioStream->setupCodec(codec, codecName, avatarAudioStream->isStereo() ? AudioConstants::STEREO : AudioConstants::MONO);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if INJECTORS_SUPPORT_CODECS
|
#if INJECTORS_SUPPORT_CODECS
|
||||||
|
|
|
@ -782,7 +782,7 @@ void AudioClient::selectAudioFormat(const QString& selectedCodecName) {
|
||||||
|
|
||||||
_selectedCodecName = selectedCodecName;
|
_selectedCodecName = selectedCodecName;
|
||||||
|
|
||||||
qCDebug(audioclient) << "Selected Codec:" << _selectedCodecName;
|
qCDebug(audioclient) << "Selected Codec:" << _selectedCodecName << "isStereoInput:" << _isStereoInput;
|
||||||
|
|
||||||
// release any old codec encoder/decoder first...
|
// release any old codec encoder/decoder first...
|
||||||
if (_codec && _encoder) {
|
if (_codec && _encoder) {
|
||||||
|
@ -797,7 +797,7 @@ void AudioClient::selectAudioFormat(const QString& selectedCodecName) {
|
||||||
if (_selectedCodecName == plugin->getName()) {
|
if (_selectedCodecName == plugin->getName()) {
|
||||||
_codec = plugin;
|
_codec = plugin;
|
||||||
_receivedAudioStream.setupCodec(plugin, _selectedCodecName, AudioConstants::STEREO);
|
_receivedAudioStream.setupCodec(plugin, _selectedCodecName, AudioConstants::STEREO);
|
||||||
_encoder = plugin->createEncoder(AudioConstants::SAMPLE_RATE, AudioConstants::MONO);
|
_encoder = plugin->createEncoder(AudioConstants::SAMPLE_RATE, _isStereoInput ? AudioConstants::STEREO : AudioConstants::MONO);
|
||||||
qCDebug(audioclient) << "Selected Codec Plugin:" << _codec.get();
|
qCDebug(audioclient) << "Selected Codec Plugin:" << _codec.get();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue