mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 11:03:01 +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.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@ -82,18 +81,14 @@ public class NvVideoStream {
|
||||
{
|
||||
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
|
||||
{
|
||||
byte[] firstFrame = depacketizer.allocatePacketBuffer();
|
||||
Socket s = new Socket(host, FIRST_FRAME_PORT);
|
||||
|
||||
System.out.println("VID: Waiting for first frame");
|
||||
InputStream firstFrameStream = openFirstFrameInputStream(host);
|
||||
InputStream firstFrameStream = s.getInputStream();
|
||||
|
||||
int offset = 0;
|
||||
for (;;)
|
||||
@ -106,6 +101,8 @@ public class NvVideoStream {
|
||||
offset += bytesRead;
|
||||
}
|
||||
|
||||
s.close();
|
||||
|
||||
System.out.println("VID: First frame read ("+offset+" bytes)");
|
||||
|
||||
depacketizer.addInputData(new AvVideoPacket(new AvByteBufferDescriptor(firstFrame, 0, offset)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user