From aebad5de5f629826ae4e63df7c48cab204999b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Wed, 15 Jun 2016 15:31:32 +0200 Subject: Fix Theora video playback without a Vorbis stream - prevent audio resampler errors when number of channels is 0, - don't check for 'audio_done' when there is no audio data. (cherry picked from commit 763b29f34e8c99c2f9559dcc31b59f99d0d6dee3) --- scene/gui/video_player.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'scene') diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 26227d6389..e9ff76bd91 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -208,10 +208,17 @@ void VideoPlayer::set_stream(const Ref &p_stream) { playback->set_paused(paused); texture=playback->get_texture(); + const int channels = playback->get_channels(); + AudioServer::get_singleton()->lock(); - resampler.setup(playback->get_channels(),playback->get_mix_rate(),server_mix_rate,buffering_ms,0); + if (channels > 0) + resampler.setup(channels,playback->get_mix_rate(),server_mix_rate,buffering_ms,0); + else + resampler.clear(); AudioServer::get_singleton()->unlock(); - playback->set_mix_callback(_audio_mix_callback,this); + + if (channels > 0) + playback->set_mix_callback(_audio_mix_callback,this); } else { texture.unref(); -- cgit v1.2.3