运用jlibrtp-0.2.2发送数据,怎么收不到包啊!!请大虾,大牛们给点建议
public class MySendDemo {
public RTPSession rtpSession = null;
static int pktCount = 0;
public MySendDemo(){
DatagramSocket rtpSocket = null;
DatagramSocket rtcpSocket = null;

try {
rtpSocket = new DatagramSocket(16386);
rtcpSocket = new DatagramSocket(16387);
} catch (Exception e) {
System.out.println("RTPSession failed to obtain port");
}

rtpSession = new RTPSession(rtpSocket, rtcpSocket);
}
public static void main(String[] args) {
MySendDemo aDemo = new MySendDemo();
Participant p = new Participant("192.168.0.115",16384,16385);
aDemo.rtpSession.addParticipant(p);
aDemo.run();
System.out.println("pktCount: " + pktCount);
}
private void run() {
if(RTPSession.rtpDebugLevel > 1) {
System.out.println("-> Run()");


String sendDate = "123456789";
for (int i = 0; i < 10000; i++) {
rtpSession.sendData(sendDate.getBytes());
}


}
}代码中是否有问题啊?????

解决方案 »

  1.   

    有个service的问题:
    private MyService myService=null;//先创建Intent intent1=new Intent(Clinent2Activity.this,MyService.class);Clinent2Activity.this.startService(intent1);//启动service 
    bindService(intent1,serviceConnection, Context.BIND_AUTO_CREATE);//绑定可是到了这里为什么 myService还是为null初次使用service,求指导啊! 
      

  2.   

    你的类没有实现RTPAppIntf接口,public class MySendDemo implements RTPAppIntf,你再试试
      

  3.   


    你好 我也是正在android上用jlibrtp这个库 也遇到了类似问题 您说的的这个接口我实现了。。实际上我把两个可以互相传数据的java端 改成了 接收端放到android上 发送端不变 还是java 然后就不能传数据了 
    android这块自己刚接触 您要是做过还请多指导啊!
    我看log发现接收端挪到安卓之后 两边RTCP协议的RTCPPaktSDES包好像出了问题 就是本身两个都是java端的时候 两边都会有一个adding participant的过程 相当于互相识别了 放到队列里了  但是现在就没有!