mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 03:23:07 +00:00
Set the datagram destination manually for ping packets rather than connecting the datagram socket explicitly. This prevents the ICMP port unreachable message from being propagated to the receive thread which causes an IOException.
This commit is contained in:
parent
0fe7549942
commit
c8b94217cf
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||||||
import java.net.DatagramPacket;
|
import java.net.DatagramPacket;
|
||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
@ -92,7 +93,6 @@ public class NvAudioStream {
|
|||||||
private void setupRtpSession() throws SocketException
|
private void setupRtpSession() throws SocketException
|
||||||
{
|
{
|
||||||
rtp = new DatagramSocket(RTP_PORT);
|
rtp = new DatagramSocket(RTP_PORT);
|
||||||
rtp.connect(host, RTP_PORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupAudio()
|
private void setupAudio()
|
||||||
@ -221,6 +221,7 @@ public class NvAudioStream {
|
|||||||
// PING in ASCII
|
// PING in ASCII
|
||||||
final byte[] pingPacketData = new byte[] {0x50, 0x49, 0x4E, 0x47};
|
final byte[] pingPacketData = new byte[] {0x50, 0x49, 0x4E, 0x47};
|
||||||
DatagramPacket pingPacket = new DatagramPacket(pingPacketData, pingPacketData.length);
|
DatagramPacket pingPacket = new DatagramPacket(pingPacketData, pingPacketData.length);
|
||||||
|
pingPacket.setSocketAddress(new InetSocketAddress(host, RTP_PORT));
|
||||||
|
|
||||||
// Send PING every 100 ms
|
// Send PING every 100 ms
|
||||||
while (!isInterrupted())
|
while (!isInterrupted())
|
||||||
|
@ -127,7 +127,6 @@ public class NvVideoStream {
|
|||||||
public void setupRtpSession() throws SocketException
|
public void setupRtpSession() throws SocketException
|
||||||
{
|
{
|
||||||
rtp = new DatagramSocket(RTP_PORT);
|
rtp = new DatagramSocket(RTP_PORT);
|
||||||
rtp.connect(host, RTP_PORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupDecoderRenderer(Surface renderTarget) {
|
public void setupDecoderRenderer(Surface renderTarget) {
|
||||||
@ -280,6 +279,7 @@ public class NvVideoStream {
|
|||||||
// PING in ASCII
|
// PING in ASCII
|
||||||
final byte[] pingPacketData = new byte[] {0x50, 0x49, 0x4E, 0x47};
|
final byte[] pingPacketData = new byte[] {0x50, 0x49, 0x4E, 0x47};
|
||||||
DatagramPacket pingPacket = new DatagramPacket(pingPacketData, pingPacketData.length);
|
DatagramPacket pingPacket = new DatagramPacket(pingPacketData, pingPacketData.length);
|
||||||
|
pingPacket.setSocketAddress(new InetSocketAddress(host, RTP_PORT));
|
||||||
|
|
||||||
// Send PING every 100 ms
|
// Send PING every 100 ms
|
||||||
while (!isInterrupted())
|
while (!isInterrupted())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user