mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 23:36:41 +02:00
don't use QDataStream in parseData since we don't really need it
This commit is contained in:
parent
e6365a1b4d
commit
e7acd0bad3
1 changed files with 7 additions and 8 deletions
|
@ -38,28 +38,27 @@ PositionalAudioRingBuffer::~PositionalAudioRingBuffer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int PositionalAudioRingBuffer::parseData(const QByteArray& packet) {
|
int PositionalAudioRingBuffer::parseData(const QByteArray& packet) {
|
||||||
QDataStream packetStream(packet);
|
|
||||||
|
|
||||||
// skip the packet header (includes the source UUID)
|
// skip the packet header (includes the source UUID)
|
||||||
packetStream.skipRawData(numBytesForPacketHeader(packet));
|
int readBytes = numBytesForPacketHeader(packet);
|
||||||
|
|
||||||
packetStream.skipRawData(parsePositionalData(packet.mid(packetStream.device()->pos())));
|
readBytes += parsePositionalData(packet.mid(readBytes));
|
||||||
|
|
||||||
if (packetTypeForPacket(packet) == PacketTypeSilentAudioFrame) {
|
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.readRawData(reinterpret_cast<char*>(&numSilentSamples), sizeof(int16_t));
|
memcpy(&numSilentSamples, packet.data(), sizeof(int16_t));
|
||||||
|
readBytes += sizeof(int16_t);
|
||||||
|
|
||||||
|
|
||||||
addSilentFrame(numSilentSamples);
|
addSilentFrame(numSilentSamples);
|
||||||
} else {
|
} else {
|
||||||
// there is audio data to read
|
// there is audio data to read
|
||||||
packetStream.skipRawData(writeData(packet.data() + packetStream.device()->pos(),
|
readBytes += writeData(packet.data() + readBytes, packet.size() - readBytes);
|
||||||
packet.size() - packetStream.device()->pos()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return readBytes;
|
||||||
return packetStream.device()->pos();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int PositionalAudioRingBuffer::parsePositionalData(const QByteArray& positionalByteArray) {
|
int PositionalAudioRingBuffer::parsePositionalData(const QByteArray& positionalByteArray) {
|
||||||
|
|
Loading…
Reference in a new issue