KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My goal is to transmit *.wav file over LAN network without delay or with minimal one. Also we read a file on a server machine by parts, 320 bytes both. After this we send packets by UDP and write receiving in jitter-buffer. The size of the jitter-buffer is 10. What delays should I set on timers for clear sound? Here is the sender: void MainWindow::on_start_tx_triggered() { timer1 = new QTimer (this); udpSocketout = new QUdpSocket(this); qDebug()<<"Start"; for (int i = 0; i < playlist.size(); ++i) { inputFile.setFileName(playlist.at(i)); qDebug()<<inputFile.fileName(); if (!inputFile.open(QIODevice::ReadOnly)) { qDebug()<< "file not found;"; } } connect(timer1, SIGNAL(timeout()), this, SLOT(writeDatagrams())); timer1->start(5); } void MainWindow::writeDatagrams() { if(!inputFile.atEnd()){ payloadout = inputFile.read(320); } qDebug()<<payloadout; QDataStream out(&datagramout, QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_4_7); out << qint64(0); out << payloadout; out.device()->seek(qint64(0)); out << qint64(datagramout.size() - sizeof(qint64)); qint64 writtenBytes = udpSocketout->writeDatagram(datagramout, remoteHOST, remotePORT); qDebug() << "Sent " << writtenBytes << " bytes."; } Here is the receiver and player: void MainWindow::on_start_rx_triggered() { udpSocketin = new QUdpSocket(this); udpSocketin->bind(localHOST, localPORT); connect(udpSocketin, SIGNAL(readyRead()), this, SLOT(readDatagrams())); QDataStream out(&datagramout, QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_4_7); timer2 = new QTimer (this); connect(timer2, SIGNAL(timeout()), this, SLOT(playbuff())); timer2->start(50); audioout = new QAudioOutput(fo
Tags (comma-separated)
Save Edits
Cancel