如何使用java efflux库

时间:2012-11-26 02:58:37

标签: java rtsp rtp

最近我在https://github.com/brunodecarvalho/efflux找到了一个RTP / RTSP库。我想学习和使用该项目,但我无法获得任何示例或手册。任何人都可以提供这些材料吗?

2 个答案:

答案 0 :(得分:0)

似乎没有容易获得的。您可以尝试查看测试here,以了解使用情况。

答案 1 :(得分:0)

我无法让它发挥作用,但我认为它必须是这样的:

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();