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 763b29f34e)
This commit is contained in:
Błażej Szczygieł 2016-06-15 15:31:32 +02:00 committed by Rémi Verschelde
parent 65bcde0a7d
commit aebad5de5f
2 changed files with 10 additions and 3 deletions

View File

@ -513,7 +513,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
}
bool frame_done=false;
bool audio_done=false;
bool audio_done=!vorbis_p;
bool theora_done=false;

View File

@ -208,9 +208,16 @@ void VideoPlayer::set_stream(const Ref<VideoStream> &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();
if (channels > 0)
playback->set_mix_callback(_audio_mix_callback,this);
} else {