소스 검색

wasapi: Clamp device->spec.samples to the hardware buffer size.

Reference Issue #8924.

(cherry picked from commit ad1a11164c872aecd72803fb9a319c4e5fcbcfaf)
Ryan C. Gordon 1 년 전
부모
커밋
1e06a3614f
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      src/audio/wasapi/SDL_wasapi.c

+ 5 - 0
src/audio/wasapi/SDL_wasapi.c

@@ -486,6 +486,11 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
         this->spec.samples = (Uint16)SDL_ceilf(period_frames);
     }
 
+    /* regardless of what we calculated for the period size, clamp it to the expected hardware buffer size. */
+    if (this->spec.samples > bufsize) {
+        this->spec.samples = bufsize;
+    }
+
     /* Update the fragment size as size in bytes */
     SDL_CalculateAudioSpec(&this->spec);