Procházet zdrojové kódy

audio: Capture devices should respect logical device pausing.

Ryan C. Gordon před 2 roky
rodič
revize
3e10c0005d
1 změnil soubory, kde provedl 4 přidání a 0 odebrání
  1. 4 0
      src/audio/SDL_audio.c

+ 4 - 0
src/audio/SDL_audio.c

@@ -774,6 +774,10 @@ SDL_bool SDL_CaptureAudioThreadIterate(SDL_AudioDevice *device)
             retval = SDL_FALSE;
             retval = SDL_FALSE;
         } else if (rc > 0) {  // queue the new data to each bound stream.
         } else if (rc > 0) {  // queue the new data to each bound stream.
             for (SDL_LogicalAudioDevice *logdev = device->logical_devices; logdev != NULL; logdev = logdev->next) {
             for (SDL_LogicalAudioDevice *logdev = device->logical_devices; logdev != NULL; logdev = logdev->next) {
+                if (SDL_AtomicGet(&logdev->paused)) {
+                    continue;  // paused? Skip this logical device.
+                }
+
                 for (SDL_AudioStream *stream = logdev->bound_streams; stream != NULL; stream = stream->next_binding) {
                 for (SDL_AudioStream *stream = logdev->bound_streams; stream != NULL; stream = stream->next_binding) {
                     /* this will hold a lock on `stream` while putting. We don't explicitly lock the streams
                     /* this will hold a lock on `stream` while putting. We don't explicitly lock the streams
                        for iterating here because the binding linked list can only change while the device lock is held.
                        for iterating here because the binding linked list can only change while the device lock is held.