Debug messages about alsa audio done in java

This commit is contained in:
Iwan Timmer
2014-02-17 16:55:21 +01:00
parent daf1a94ba7
commit 3caff7075e
2 changed files with 10 additions and 4 deletions

View File

@@ -43,8 +43,6 @@ int nv_alsa_play(const unsigned char* indata, int data_len) {
int frames = data_len/4; /* 2 bytes/sample, 2 channels */ int frames = data_len/4; /* 2 bytes/sample, 2 channels */
int rc = snd_pcm_writei(handle, indata, frames); int rc = snd_pcm_writei(handle, indata, frames);
if (rc == -EPIPE) { if (rc == -EPIPE) {
/* EPIPE means underrun */
fprintf(stderr, "underrun occurred\n");
snd_pcm_prepare(handle); snd_pcm_prepare(handle);
} else if (rc < 0) { } else if (rc < 0) {
fprintf(stderr, fprintf(stderr,
@@ -54,6 +52,8 @@ int nv_alsa_play(const unsigned char* indata, int data_len) {
fprintf(stderr, fprintf(stderr,
"short write, write %d frames\n", rc); "short write, write %d frames\n", rc);
} }
return rc;
} }
int nv_alsa_close(void) { int nv_alsa_close(void) {

View File

@@ -1,5 +1,6 @@
package com.limelight.binding.audio; package com.limelight.binding.audio;
import com.limelight.LimeLog;
import com.limelight.nvstream.av.audio.AudioRenderer; import com.limelight.nvstream.av.audio.AudioRenderer;
/** /**
@@ -23,7 +24,12 @@ public class AlsaAudioRenderer implements AudioRenderer {
@Override @Override
public void playDecodedAudio(byte[] bytes, int offset, int length) { public void playDecodedAudio(byte[] bytes, int offset, int length) {
AlsaAudio.play(bytes, offset, length); int rc = AlsaAudio.play(bytes, offset, length);
if (rc<0)
LimeLog.warning("Alsa error from writei: "+rc);
else if (rc!=length/4)
LimeLog.warning("Alsa short write, write "+rc+" frames");
} }
@Override @Override