mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-10 18:06:10 +00:00
Merge branch 'master' of github.com:limelight-stream/limelight-common into logs
* 'master' of github.com:limelight-stream/limelight-common: Revert "Lower queued decode unit limit to resync faster if the renderers get behind. Lower the audio receive buffer size since it was unneccessarily large." Update README.md Revert the DU_LIMIT changes due to variance in platform audio rendering speed Lower queued decode unit limit to resync faster if the renderers get behind. Lower the audio receive buffer size since it was unneccessarily large. Drop code compliance to Java 1.5. Minor annotation changes for 1.5 compliance. Remove depacketizer thread add gpl
This commit is contained in:
@@ -289,7 +289,6 @@ public class NvConnection {
|
||||
this.videoDecoderRenderer = videoDecoderRenderer;
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
hostAddr = InetAddress.getByName(host);
|
||||
@@ -309,7 +308,6 @@ public class NvConnection {
|
||||
return;
|
||||
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
inputStream.sendMouseMove(deltaX, deltaY);
|
||||
@@ -326,7 +324,6 @@ public class NvConnection {
|
||||
return;
|
||||
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
inputStream.sendMouseButtonDown(mouseButton);
|
||||
@@ -343,7 +340,6 @@ public class NvConnection {
|
||||
return;
|
||||
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
inputStream.sendMouseButtonUp(mouseButton);
|
||||
@@ -363,7 +359,6 @@ public class NvConnection {
|
||||
return;
|
||||
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
inputStream.sendControllerInput(buttonFlags, leftTrigger,
|
||||
@@ -381,7 +376,6 @@ public class NvConnection {
|
||||
return;
|
||||
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
inputStream.sendKeyboardInput(keyMap, keyDirection, modifier);
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import com.limelight.nvstream.NvConnectionListener;
|
||||
import com.limelight.nvstream.av.ByteBufferDescriptor;
|
||||
@@ -19,8 +18,6 @@ public class AudioStream {
|
||||
|
||||
public static final int RTP_RECV_BUFFER = 64 * 1024;
|
||||
|
||||
private LinkedBlockingQueue<RtpPacket> packets = new LinkedBlockingQueue<RtpPacket>(100);
|
||||
|
||||
private DatagramSocket rtp;
|
||||
|
||||
private AudioDepacketizer depacketizer = new AudioDepacketizer();
|
||||
@@ -77,8 +74,6 @@ public class AudioStream {
|
||||
|
||||
startReceiveThread();
|
||||
|
||||
startDepacketizerThread();
|
||||
|
||||
startDecoderThread();
|
||||
|
||||
startUdpPingThread();
|
||||
@@ -104,39 +99,13 @@ public class AudioStream {
|
||||
streamListener.streamInitialized(OpusDecoder.getChannelCount(), OpusDecoder.getSampleRate());
|
||||
}
|
||||
|
||||
private void startDepacketizerThread()
|
||||
{
|
||||
// This thread lessens the work on the receive thread
|
||||
// so it can spend more time waiting for data
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
while (!isInterrupted())
|
||||
{
|
||||
RtpPacket packet;
|
||||
|
||||
try {
|
||||
packet = packets.take();
|
||||
} catch (InterruptedException e) {
|
||||
connListener.connectionTerminated(e);
|
||||
return;
|
||||
}
|
||||
|
||||
depacketizer.decodeInputData(packet);
|
||||
}
|
||||
}
|
||||
};
|
||||
threads.add(t);
|
||||
t.setName("Audio - Depacketizer");
|
||||
t.start();
|
||||
}
|
||||
|
||||
private void startDecoderThread()
|
||||
{
|
||||
// Decoder thread
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
while (!isInterrupted())
|
||||
{
|
||||
ByteBufferDescriptor samples;
|
||||
@@ -149,6 +118,7 @@ public class AudioStream {
|
||||
}
|
||||
|
||||
streamListener.playDecodedAudio(samples.data, samples.offset, samples.length);
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -170,17 +140,14 @@ public class AudioStream {
|
||||
{
|
||||
try {
|
||||
rtp.receive(packet);
|
||||
desc.length = packet.getLength();
|
||||
depacketizer.decodeInputData(new RtpPacket(desc));
|
||||
desc.reinitialize(new byte[1500], 0, 1500);
|
||||
packet.setData(desc.data, desc.offset, desc.length);
|
||||
} catch (IOException e) {
|
||||
connListener.connectionTerminated(e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Give the packet to the depacketizer thread
|
||||
desc.length = packet.getLength();
|
||||
if (packets.offer(new RtpPacket(desc))) {
|
||||
desc.reinitialize(new byte[1500], 0, 1500);
|
||||
packet.setData(desc.data, desc.offset, desc.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import com.limelight.nvstream.NvConnectionListener;
|
||||
import com.limelight.nvstream.StreamConfiguration;
|
||||
@@ -26,8 +25,6 @@ public class VideoStream {
|
||||
public static final int FIRST_FRAME_TIMEOUT = 5000;
|
||||
public static final int RTP_RECV_BUFFER = 128 * 1024;
|
||||
|
||||
private LinkedBlockingQueue<RtpPacket> packets = new LinkedBlockingQueue<RtpPacket>(100);
|
||||
|
||||
private InetAddress host;
|
||||
private DatagramSocket rtp;
|
||||
private Socket firstFrameSocket;
|
||||
@@ -161,9 +158,6 @@ public class VideoStream {
|
||||
// early packets
|
||||
startReceiveThread();
|
||||
|
||||
// Start the depacketizer thread to deal with the RTP data
|
||||
startDepacketizerThread();
|
||||
|
||||
// Start decoding the data we're receiving
|
||||
startDecoderThread();
|
||||
|
||||
@@ -200,34 +194,6 @@ public class VideoStream {
|
||||
t.start();
|
||||
}
|
||||
|
||||
private void startDepacketizerThread()
|
||||
{
|
||||
// This thread lessens the work on the receive thread
|
||||
// so it can spend more time waiting for data
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
while (!isInterrupted())
|
||||
{
|
||||
RtpPacket packet;
|
||||
|
||||
try {
|
||||
packet = packets.take();
|
||||
} catch (InterruptedException e) {
|
||||
listener.connectionTerminated(e);
|
||||
return;
|
||||
}
|
||||
|
||||
// !!! We no longer own the data buffer at this point !!!
|
||||
depacketizer.addInputData(packet);
|
||||
}
|
||||
}
|
||||
};
|
||||
threads.add(t);
|
||||
t.setName("Video - Depacketizer");
|
||||
t.start();
|
||||
}
|
||||
|
||||
private void startReceiveThread()
|
||||
{
|
||||
// Receive thread
|
||||
@@ -241,17 +207,15 @@ public class VideoStream {
|
||||
{
|
||||
try {
|
||||
rtp.receive(packet);
|
||||
desc.length = packet.getLength();
|
||||
depacketizer.addInputData(new RtpPacket(desc));
|
||||
desc.reinitialize(new byte[1500], 0, 1500);
|
||||
packet.setData(desc.data, desc.offset, desc.length);
|
||||
} catch (IOException e) {
|
||||
listener.connectionTerminated(e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Give the packet to the depacketizer thread
|
||||
desc.length = packet.getLength();
|
||||
if (packets.offer(new RtpPacket(desc))) {
|
||||
desc.reinitialize(new byte[1500], 0, 1500);
|
||||
packet.setData(desc.data, desc.offset, desc.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -401,12 +401,10 @@ public class ControlStream implements ConnectionStatusListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionTerminated() {
|
||||
abort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionNeedsResync() {
|
||||
synchronized (resyncNeeded) {
|
||||
// Wake up the resync thread
|
||||
|
||||
Reference in New Issue
Block a user