kopia lustrzana https://gitlab.com/eliggett/wfview
Fix tx audio packet
rodzic
6e53e1e683
commit
258b56fc58
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
// Variable size packets + payload
|
// Variable size packets + payload
|
||||||
#define CIV_SIZE 0x15
|
#define CIV_SIZE 0x15
|
||||||
#define TXAUDIO_SIZE 0x15
|
#define TXAUDIO_SIZE 0x18
|
||||||
#define DATA_SIZE 0x15
|
#define DATA_SIZE 0x15
|
||||||
|
|
||||||
// 0x10 length control packet (connect/disconnect/idle.)
|
// 0x10 length control packet (connect/disconnect/idle.)
|
||||||
|
@ -56,7 +56,25 @@ typedef union ping_packet {
|
||||||
|
|
||||||
};
|
};
|
||||||
char packet[PING_SIZE];
|
char packet[PING_SIZE];
|
||||||
} *ping_packet_t, *data_packet_t, data_packet;
|
} *ping_packet_t, * data_packet_t, data_packet;
|
||||||
|
|
||||||
|
|
||||||
|
// 0x18 length txaudio packet
|
||||||
|
typedef union txaudio_packet {
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
quint32 len; // 0x00
|
||||||
|
quint16 type; // 0x04
|
||||||
|
quint16 seq; // 0x06
|
||||||
|
quint32 sentid; // 0x08
|
||||||
|
quint32 rcvdid; // 0x0c
|
||||||
|
quint16 ident; // 0x10
|
||||||
|
quint16 sendseq; // 0x12
|
||||||
|
quint16 unused; // 0x14
|
||||||
|
quint16 datalen; // 0x16
|
||||||
|
};
|
||||||
|
char packet[TXAUDIO_SIZE];
|
||||||
|
} *txaudio_packet_t;
|
||||||
|
|
||||||
|
|
||||||
// 0x18 length txaudio packet
|
// 0x18 length txaudio packet
|
||||||
|
|
|
@ -648,23 +648,31 @@ void udpAudio::sendTxAudio()
|
||||||
if (txaudio->chunkAvailable) {
|
if (txaudio->chunkAvailable) {
|
||||||
QByteArray audio;
|
QByteArray audio;
|
||||||
txaudio->getNextAudioChunk(audio);
|
txaudio->getNextAudioChunk(audio);
|
||||||
int counter = 0;
|
int counter = 1;
|
||||||
while (counter < audio.length()) {
|
int len = 0;
|
||||||
QByteArray partial = audio.mid(counter, 1364);
|
while (len < audio.length()) {
|
||||||
ping_packet p;
|
QByteArray partial = audio.mid(len, 1364);
|
||||||
|
txaudio_packet p;
|
||||||
memset(p.packet, 0x0, sizeof(p)); // We can't be sure it is initialized with 0x00!
|
memset(p.packet, 0x0, sizeof(p)); // We can't be sure it is initialized with 0x00!
|
||||||
p.len = sizeof(p);
|
p.len = sizeof(p)+partial.length();
|
||||||
p.sentid = myId;
|
p.sentid = myId;
|
||||||
p.rcvdid = remoteId;
|
p.rcvdid = remoteId;
|
||||||
p.reply = (char)0x80;
|
if (counter % 2 == 0)
|
||||||
p.datalen = partial.length();
|
{
|
||||||
p.sendseq = qToBigEndian(sendAudioSeq); // THIS IS BIG ENDIAN!
|
p.ident = 0x0680;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.ident = 0x0681;
|
||||||
|
}
|
||||||
|
p.datalen = (quint16)qToBigEndian((quint16)partial.length());
|
||||||
|
p.sendseq = (quint16)qToBigEndian(sendAudioSeq); // THIS IS BIG ENDIAN!
|
||||||
QByteArray tx = QByteArray::fromRawData((const char*)p.packet, sizeof(p));
|
QByteArray tx = QByteArray::fromRawData((const char*)p.packet, sizeof(p));
|
||||||
tx.append(partial);
|
tx.append(partial);
|
||||||
counter = counter + partial.length();
|
len = len + partial.length();
|
||||||
//qDebug() << "Sending audio packet length: " << tx.length();
|
//qDebug() << "Sending audio packet length: " << tx.length();
|
||||||
sendTrackedPacket(tx);
|
sendTrackedPacket(tx);
|
||||||
sendAudioSeq++;
|
sendAudioSeq++;
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue