mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-06-17 06:11:36 +00:00
Fix for using default soundcard
This commit is contained in:
@@ -6,17 +6,16 @@
|
|||||||
// This function must be called before
|
// This function must be called before
|
||||||
// any other decoding functions
|
// any other decoding functions
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_com_limelight_binding_audio_AlsaAudio_init(JNIEnv *env, jobject this, jint channelCount, jint sampleRate, jbyteArray device)
|
Java_com_limelight_binding_audio_AlsaAudio_init(JNIEnv *env, jobject this, jint channelCount, jint sampleRate, jstring device)
|
||||||
{
|
{
|
||||||
jint ret;
|
jint ret;
|
||||||
jbyte* jni_device;
|
char* jni_device;
|
||||||
|
|
||||||
jni_device = (*env)->GetByteArrayElements(env, device, 0);
|
jni_device = (*env)->GetStringUTFChars(env, device, 0);
|
||||||
|
|
||||||
ret = nv_alsa_init(channelCount, sampleRate, jni_device);
|
ret = nv_alsa_init(channelCount, sampleRate, jni_device);
|
||||||
|
|
||||||
// The input data isn't changed so it can be safely aborted
|
(*env)->ReleaseStringUTFChars(env, device, jni_device);
|
||||||
(*env)->ReleaseByteArrayElements(env, device, jni_device, JNI_ABORT);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -43,4 +42,4 @@ Java_com_limelight_binding_audio_AlsaAudio_play(
|
|||||||
(*env)->ReleaseByteArrayElements(env, indata, jni_input_data, JNI_ABORT);
|
(*env)->ReleaseByteArrayElements(env, indata, jni_input_data, JNI_ABORT);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class Limelight implements NvConnectionListener {
|
|||||||
int refresh = 60;
|
int refresh = 60;
|
||||||
boolean parse = true;
|
boolean parse = true;
|
||||||
String mapping = null;
|
String mapping = null;
|
||||||
String audio = "hw:0";
|
String audio = "hw:0,0";
|
||||||
|
|
||||||
for (int i = 0; i < args.length - 1; i++) {
|
for (int i = 0; i < args.length - 1; i++) {
|
||||||
if (args[i].equals("-input")) {
|
if (args[i].equals("-input")) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class AlsaAudio {
|
|||||||
System.loadLibrary("nv_alsa");
|
System.loadLibrary("nv_alsa");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static native int init(int channelCount, int sampleRate, byte[] device);
|
public static native int init(int channelCount, int sampleRate, String device);
|
||||||
|
|
||||||
public static native void close();
|
public static native void close();
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class AlsaAudioRenderer implements AudioRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void streamInitialized(int channelCount, int sampleRate) {
|
public void streamInitialized(int channelCount, int sampleRate) {
|
||||||
int ret = AlsaAudio.init(channelCount, sampleRate, device.getBytes());
|
int ret = AlsaAudio.init(channelCount, sampleRate, device);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
throw new IllegalStateException("AVC decoder initialization failure: "+ret);
|
throw new IllegalStateException("AVC decoder initialization failure: "+ret);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user