最近我在 https://github.com/jonbo372/efflux 上找到了一个 RTP/RTSP 库.我想学习和使用该项目,但我无法获得任何示例或手册。谁能提供这些 Material ?
最佳答案
我无法让它工作,但我认为它一定是这样的:
String server = "example.com"; // you need to set this
long ssrc = 0; // you need to set this
String sessionid = "???"; // you need to set this
int server_data_port = 0; // you need to set this
int server_ctrl_port = 0; // you need to set this
int my_data_port = 8000; // you can pick this
int my_ctrl_port = 8001; // you can pick this
int payloadType = 0; // set from RTP spec. I want to send H.264 but don't see a number for that. http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xml
RtpParticipant pThem = RtpParticipant.createReceiver(server, server_data_port, server_ctrl_port);
pThem.getInfo().setSsrc(ssrc);
RtpParticipant pMe = RtpParticipant.createReceiver("0.0.0.0", my_data_port, my_ctrl_port);
pMe.getInfo().setSsrc(ssrc); // I guess both have the same ssrc?
RtpSession session = new SingleParticipantSession(sessionid, payloadType, pMe, pThem);
session.addDataListener(new RtpSessionDataListener() {
@Override
public void dataPacketReceived(RtpSession session, RtpParticipantInfo participant, DataPacket packet) {
// Do something with the data
}});
session.init();
关于java - Java 流出库的使用方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13558089/