Browse Source

Clear resample_offset in SDL_ClearAudioStream, not SetAudioStreamFormat
Not entirely sure if ClearAudioStream is the right place, but SetAudioStreamFormat was the wrong place

Brick 2 years ago
parent
commit
7bb4e806ea
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/audio/SDL_audiocvt.c

+ 1 - 1
src/audio/SDL_audiocvt.c

@@ -554,7 +554,6 @@ static int SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *sr
         stream->history_buffer_allocation = history_buffer_allocation;
         stream->history_buffer_allocation = history_buffer_allocation;
     }
     }
 
 
-    stream->resample_offset = 0;
     stream->resampler_padding_frames = resampler_padding_frames;
     stream->resampler_padding_frames = resampler_padding_frames;
     stream->history_buffer_frames = history_buffer_frames;
     stream->history_buffer_frames = history_buffer_frames;
     stream->max_sample_frame_size = max_sample_frame_size;
     stream->max_sample_frame_size = max_sample_frame_size;
@@ -1141,6 +1140,7 @@ int SDL_ClearAudioStream(SDL_AudioStream *stream)
     if (stream->history_buffer != NULL) {
     if (stream->history_buffer != NULL) {
         SDL_memset(stream->history_buffer, SDL_GetSilenceValueForFormat(stream->src_spec.format), stream->history_buffer_frames * stream->src_spec.channels * sizeof (float));
         SDL_memset(stream->history_buffer, SDL_GetSilenceValueForFormat(stream->src_spec.format), stream->history_buffer_frames * stream->src_spec.channels * sizeof (float));
     }
     }
+    stream->resample_offset = 0;
     stream->future_buffer_filled_frames = 0;
     stream->future_buffer_filled_frames = 0;
     stream->flushed = SDL_FALSE;
     stream->flushed = SDL_FALSE;
     SDL_UnlockMutex(stream->lock);
     SDL_UnlockMutex(stream->lock);