私は Android の Java で RTP をいじり始めましたが、誰かが私に少しの助けやガイダンスを与えてくれるかどうか疑問に思っていました。
これが私が始めたコードです:
public void rtpTest() throws UnknownHostException, SocketException, RtpException{
RtpManager rtpManager = new RtpManager(myAddress);
Log.d("RTPMANAGER", "IPADDRESS here = " + rtpManager.getMyIpAddress());
tpSession rtpSession = rtpManager.createRtpSession(6040);
Log.d("RTPMANAGER", "IPADDRESS here 2");
rtpSession.addRtpListener(this);
Log.d("RTPMANAGER", "IPADDRESS here 3");
RtpPacketReceiver rtpPacketReciever = new RtpPacketReceiver(rtpSession);
Log.d("RTPMANAGER", "IPADDRESS here 4");
//DatagramSocket ds = new DatagramSocket(6042);
//ds.bind(null);
rtpSession.setRemoteIpAddress(getLocalIpAddress());
Log.d("RTPMANAGER", "IPADDRESS recv port = " + getLocalIpAddress() );
rtpSession.setRemoteRtpRecvPort(5060);
rtpSession.receiveRTPPackets();
Log.d("RTPMANAGER", "REMOTE - IPADDRESS = " + rtpSession.getRemoteIpAddress());
Log.d("RTPMANAGER", "Recieve port = " + rtpSession.getMyRtpRecvPort());
Log.d("RTPMANAGER", "Recieve socket = " + rtpSession.getRtpRecvSocket());
Log.d("RTPMANAGER", "RTP SESSION = " + rtpSession.toString());
Log.d("RTPMANAGER", "RTP PACKET RECEIVER = " + rtpPacketReciever.toString());
Log.d("RTPMANAGER", "RTP PACKET RECEIVER is alive? = " + rtpPacketReciever.isAlive());
rtpPacketReciever.run();
Log.d("RTPMANAGER", "RTP PACKET RECEIVER is alive? = " + rtpPacketReciever.isAlive());
Log.d("RTPMANAGER", "IPADDRESS here 5");
}
RTP マネージャ、RTP セッション、および RTP パケット レシーバを設定する正しい方法がわかりません。
最初にデータグラム ソケットを開き、それを RTP セッションにリンクする必要がありますか?
上記のコードから RTPSession を文字列に出力すると、次のようになります。
RTP SESSION = <rtp-session
senderIpAddress = "192.168.2.xxx"
remoteRtpRecvPort = "5060"
myAddress = "192.168.2.xxx"
myRtpRecvPort = "6040"
/>
それがどの程度正しいか間違っているかわかりませんか??
また、コードは rtpPacketReciever.run(); にのみ到達します。このメソッドの後のロギングは出力されないので、rtpPacketReciever.run();? に問題があると思います。
私はRTPに非常に慣れていないので、誰もが知っているガイダンスや優れたリソースは本当に役に立ちます.
前もって感謝します
編集:
編集:
このコードを追加しました:
コード:
DatagramSocket ds = rtpSession.getRtpRecvSocket();
ds.connect(InetAddress.getByName(getLocalIpAddress()), 3120);
Log.d("RTPMANAGER", "ds is bound to remote socket? " +ds.getRemoteSocketAddress());
また、ds リモート ソケットをログに記録すると、次の結果が返されます。
ds is bound to remote socket: 192.168.2.163/192.168.2.163:3120
私にはどれが間違っているように見えますか? それは...ですか?