I'm doing right now a communications software, want to send voice function complete, the current implementation approach is to use the
QAudioFormat format;
Format. SetSampleRate (8000);//set the sampling of Hertz
Format. SetChannelCount (1);//set the channel number v//set the channel number, mono (ire) track number is 1; Stero (stereo) track number is 2
Format. SetSampleSize (16);//set the sample size, usually 8 or 16
Audio/PCM format. SetCodec (" ");//set the codec
Format. SetByteOrder (QAudioFormat: : LittleEndian);//
Format. SetSampleType (QAudioFormat: : UnSignedInt);//
.
QAudioInput * input;
QAudioOutput * output;
.
To save the recording, raw is saved as a file, and then convert wav format files to play, want to use udp transport raw files, the contents of the receiver in the preservation and generate the raw files, the play is converted into wav format, but there is a serious problem, when the recording file is too large, udp transmission will be lost package, lead to transmission failure, but I don't want to use TCP,
What method can solve the above problem, please?
CodePudding user response:
Send voice messages should be use udp or TCP? My idea is that the UDP send content must be compressed audio files, otherwise easy to lost package, is not stable, using TCP, I think is too complicated, because I think that the client was not like server will always listen to port, because of my other data transmission are using UDP (words, expressions, picture (picture I am the compression of the coma, click to download the original way that haven't)), if not always listening, only to listen because of sending audio files, to establish a connection I feel too much trouble,And I found that when using WeChat send voice can't say too long (if only to the biggest 60 seconds), I guess for too long, can appear even compressed file is too large, using UDP send packet loss may arise,
CodePudding user response:
Now I think the best way is to send voice compression file before sending, because never contact with this kind of operation before, did not know how to start, the website can use lame library code to the MP3 format, MP3 format file should be a little bit small, but I will not again, also can't find this tripartite lame library, also want to have big help children,CodePudding user response:
Up up upCodePudding user response:
If the file is in the form of non real-time voice, simplex may save file, using lame lame can direct command line call,CodePudding user response: