Fix Video Player issue with audio mix_rate when different than 44100

This commit is contained in:
Marcelo Fernandez
2018-01-07 12:57:48 -03:00
parent 57efe0bea5
commit 6fc1801b6a
2 changed files with 1 additions and 9 deletions

View File

@@ -38,11 +38,6 @@ int VideoPlayer::sp_get_channel_count() const {
return playback->get_channels();
}
void VideoPlayer::sp_set_mix_rate(int p_rate) {
server_mix_rate = p_rate;
}
bool VideoPlayer::mix(AudioFrame *p_buffer, int p_frames) {
// Check the amount resampler can really handle.
@@ -241,7 +236,7 @@ void VideoPlayer::set_stream(const Ref<VideoStream> &p_stream) {
AudioServer::get_singleton()->lock();
if (channels > 0)
resampler.setup(channels, playback->get_mix_rate(), server_mix_rate, buffering_ms, 0);
resampler.setup(channels, playback->get_mix_rate(), AudioServer::get_singleton()->get_mix_rate(), buffering_ms, 0);
else
resampler.clear();
AudioServer::get_singleton()->unlock();
@@ -494,7 +489,6 @@ VideoPlayer::VideoPlayer() {
bus_index = 0;
buffering_ms = 500;
server_mix_rate = 44100;
// internal_stream.player=this;
// stream_rid=AudioServer::get_singleton()->audio_stream_create(&internal_stream);