Fix exception when stopping non-cached audio stream
This commit is contained in:
parent
44db44ee56
commit
c7b6445a35
@ -192,6 +192,10 @@ public class AudioStream extends AudioData implements Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSeekable() {
|
||||||
|
return in instanceof SeekableStream;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTime(float time) {
|
public void setTime(float time) {
|
||||||
if (in instanceof SeekableStream) {
|
if (in instanceof SeekableStream) {
|
||||||
((SeekableStream) in).setTime(time);
|
((SeekableStream) in).setTime(time);
|
||||||
|
@ -1047,7 +1047,14 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
|
|||||||
freeChannel(chan);
|
freeChannel(chan);
|
||||||
|
|
||||||
if (src.getAudioData() instanceof AudioStream) {
|
if (src.getAudioData() instanceof AudioStream) {
|
||||||
((AudioStream)src.getAudioData()).setTime(0);
|
// If the stream is seekable, then rewind it.
|
||||||
|
// Otherwise, close it, as it is no longer valid.
|
||||||
|
AudioStream stream = (AudioStream)src.getAudioData();
|
||||||
|
if (stream.isSeekable()) {
|
||||||
|
stream.setTime(0);
|
||||||
|
} else {
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user