mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 03:52:48 +00:00
Fix an unclosed closeable.
This commit is contained in:
parent
8802e05f27
commit
b34da27fbd
@ -6,7 +6,6 @@ import java.net.DatagramPacket;
|
|||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
@ -83,17 +82,13 @@ public class NvVideoStream {
|
|||||||
depacketizer.trim();
|
depacketizer.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
private InputStream openFirstFrameInputStream(String host) throws UnknownHostException, IOException
|
|
||||||
{
|
|
||||||
Socket s = new Socket(host, FIRST_FRAME_PORT);
|
|
||||||
return s.getInputStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void readFirstFrame(String host) throws IOException
|
private void readFirstFrame(String host) throws IOException
|
||||||
{
|
{
|
||||||
byte[] firstFrame = depacketizer.allocatePacketBuffer();
|
byte[] firstFrame = depacketizer.allocatePacketBuffer();
|
||||||
|
Socket s = new Socket(host, FIRST_FRAME_PORT);
|
||||||
|
|
||||||
System.out.println("VID: Waiting for first frame");
|
System.out.println("VID: Waiting for first frame");
|
||||||
InputStream firstFrameStream = openFirstFrameInputStream(host);
|
InputStream firstFrameStream = s.getInputStream();
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
@ -106,6 +101,8 @@ public class NvVideoStream {
|
|||||||
offset += bytesRead;
|
offset += bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.close();
|
||||||
|
|
||||||
System.out.println("VID: First frame read ("+offset+" bytes)");
|
System.out.println("VID: First frame read ("+offset+" bytes)");
|
||||||
|
|
||||||
depacketizer.addInputData(new AvVideoPacket(new AvByteBufferDescriptor(firstFrame, 0, offset)));
|
depacketizer.addInputData(new AvVideoPacket(new AvByteBufferDescriptor(firstFrame, 0, offset)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user