Fixed bug with clearing the stream in AudioPlayerStream
This commit is contained in:
parent
dc18b8d7e8
commit
f12b4e5fa3
1 changed files with 5 additions and 4 deletions
|
@ -122,7 +122,6 @@ void AudioStreamPlayer::_notification(int p_what) {
|
||||||
|
|
||||||
void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
|
void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
|
||||||
|
|
||||||
ERR_FAIL_COND(!p_stream.is_valid());
|
|
||||||
AudioServer::get_singleton()->lock();
|
AudioServer::get_singleton()->lock();
|
||||||
|
|
||||||
mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size());
|
mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size());
|
||||||
|
@ -134,12 +133,14 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
|
||||||
setseek = -1;
|
setseek = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_stream.is_valid()) {
|
||||||
stream = p_stream;
|
stream = p_stream;
|
||||||
stream_playback = p_stream->instance_playback();
|
stream_playback = p_stream->instance_playback();
|
||||||
|
}
|
||||||
|
|
||||||
AudioServer::get_singleton()->unlock();
|
AudioServer::get_singleton()->unlock();
|
||||||
|
|
||||||
if (stream_playback.is_null()) {
|
if (p_stream.is_valid() && stream_playback.is_null()) {
|
||||||
stream.unref();
|
stream.unref();
|
||||||
ERR_FAIL_COND(stream_playback.is_null());
|
ERR_FAIL_COND(stream_playback.is_null());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue