使用udp发送实时语音
大家好,请帮助我。 我编写了使用 udp socket 在客户端和服务器之间发送字符串消息的 java 代码。 但我想发送实时语音,所以请你给一些注释来做到这一点
hi every body could you please help me . I write java code for sending string msg between client and server using udp socket . but I want to to send real time voice so could you please give some notes to do it
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我可以为您指出一些方法,您可能想要使用 实时传输协议(RTP),这或多或少是通过网络实时发送音频或视频的标准。 然而,实现并不简单,您应该使用 jlibrtp 之类的帮助程序库来实现。 Java Media Framework (JMF) 中也有一个 RTP 打包器,但你不想去那里......
I can point you a little of the way, you probably would want to use the Real-time Transport Protocol (RTP), which is more or less the standard for sending audio or video real time over the net. However the implementation is not straight forward, and you should use a helper library like jlibrtp for the implementation. There is also a RTP packetizer in Java Media Framework (JMF), but you don't wanna go there....
UDP 没有服务质量保证,因此在发送数据包时,您需要向数据添加某种顺序号,以确定如何将数据重新组合在一起。 例如,您可以从服务器按顺序发送 3 个数据报包,但客户端可能会以不同的顺序 (2,1,3) 获取它们。 或者它可能根本得不到其中之一,在这种情况下,您要么希望它重新发送(可疑),要么干脆忽略它并在某个超时时继续前进。
UDP has no quality of service guarantee, so when sending your packets of data you will need to add some sort of order number to your data to detremine how to put the data back together. For example you could send 3 datagram packets in order from the server, yet the client may get them in a different order (2,1,3). Or it may not get one of them at all, in which case you either want it resent (doubtful) or simply ignore it and move on at some timeout.
研究使用实时协议 RFC3550 (http://en.wikipedia.org/wiki/Real- time_Transport_Protocol)
作为通过 UDP 的传输。 RTCP 作为对 TCP 的控制。
Look into using Real Time Protocol RFC3550 (http://en.wikipedia.org/wiki/Real-time_Transport_Protocol)
as the transport over UDP. RTCP as the control over TCP.