mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-17 05:58:28 +02:00
Handle packets in-flight during audio codec startup
This commit is contained in:
parent
7edb41b0ea
commit
e4e37e65e6
1 changed files with 11 additions and 5 deletions
|
@ -161,12 +161,18 @@ int InboundAudioStream::parseData(ReceivedMessage& message) {
|
|||
auto afterProperties = message.readWithoutCopy(message.getBytesLeftToRead());
|
||||
parseAudioData(message.getType(), afterProperties);
|
||||
} else {
|
||||
qDebug(audio) << "Codec mismatch: expected" << _selectedCodecName << "got" << codecInPacket << "writing silence";
|
||||
qDebug(audio) << "Codec mismatch: expected" << _selectedCodecName << "got" << codecInPacket;
|
||||
|
||||
// Since the data in the stream is using a codec that we aren't prepared for,
|
||||
// we need to let the codec know that we don't have data for it, this will
|
||||
// allow the codec to interpolate missing data and produce a fade to silence.
|
||||
lostAudioData(1);
|
||||
if (packetPCM) {
|
||||
// If there are PCM packets in-flight while the codec is changed, use them.
|
||||
auto afterProperties = message.readWithoutCopy(message.getBytesLeftToRead());
|
||||
_ringBuffer.writeData(afterProperties.data(), afterProperties.size());
|
||||
} else {
|
||||
// Since the data in the stream is using a codec that we aren't prepared for,
|
||||
// we need to let the codec know that we don't have data for it, this will
|
||||
// allow the codec to interpolate missing data and produce a fade to silence.
|
||||
lostAudioData(1);
|
||||
}
|
||||
|
||||
// inform others of the mismatch
|
||||
auto sendingNode = DependencyManager::get<NodeList>()->nodeWithUUID(message.getSourceID());
|
||||
|
|
Loading…
Reference in a new issue