mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:01:09 +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());
|
auto afterProperties = message.readWithoutCopy(message.getBytesLeftToRead());
|
||||||
parseAudioData(message.getType(), afterProperties);
|
parseAudioData(message.getType(), afterProperties);
|
||||||
} else {
|
} 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,
|
if (packetPCM) {
|
||||||
// we need to let the codec know that we don't have data for it, this will
|
// If there are PCM packets in-flight while the codec is changed, use them.
|
||||||
// allow the codec to interpolate missing data and produce a fade to silence.
|
auto afterProperties = message.readWithoutCopy(message.getBytesLeftToRead());
|
||||||
lostAudioData(1);
|
_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
|
// inform others of the mismatch
|
||||||
auto sendingNode = DependencyManager::get<NodeList>()->nodeWithUUID(message.getSourceID());
|
auto sendingNode = DependencyManager::get<NodeList>()->nodeWithUUID(message.getSourceID());
|
||||||
|
|
Loading…
Reference in a new issue