diff options
| author | Błażej Szczygieł | 2016-06-15 15:31:32 +0200 |
|---|---|---|
| committer | Błażej Szczygieł | 2016-06-17 13:38:47 +0200 |
| commit | 763b29f34e8c99c2f9559dcc31b59f99d0d6dee3 (patch) | |
| tree | b8e0cd4cbf31f74e2530f53e49dc75c6da219d76 | |
| parent | d412cb65bec2de506aa874ec2fd0c655bf76fd23 (diff) | |
| download | godot-763b29f34e8c99c2f9559dcc31b59f99d0d6dee3.tar.gz godot-763b29f34e8c99c2f9559dcc31b59f99d0d6dee3.tar.zst godot-763b29f34e8c99c2f9559dcc31b59f99d0d6dee3.zip | |
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.
| -rw-r--r-- | drivers/theora/video_stream_theora.cpp | 2 | ||||
| -rw-r--r-- | scene/gui/video_player.cpp | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/theora/video_stream_theora.cpp b/drivers/theora/video_stream_theora.cpp index e577c3f93..fc296e2d2 100644 --- a/drivers/theora/video_stream_theora.cpp +++ b/drivers/theora/video_stream_theora.cpp @@ -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; diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 89dacc657..ab2076184 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -208,10 +208,17 @@ 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(); - playback->set_mix_callback(_audio_mix_callback,this); + + if (channels > 0) + playback->set_mix_callback(_audio_mix_callback,this); } else { texture.unref(); |
