audiosrc: Leave read loop if no longer running
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 27 Nov 2014 18:52:52 +0000 (13:52 -0500)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 3 Nov 2016 17:19:12 +0000 (13:19 -0400)
In the case a src stops providing data (read calls returns 0). The audio
src thread will never leave. Instead, check the condition and leave the
loop.

gst-libs/gst/audio/gstaudiosrc.c

index efd9947..96871da 100644 (file)
@@ -246,7 +246,8 @@ audioringbuffer_thread_func (GstAudioRingBuffer * buf)
         }
         left -= read;
         readptr += read;
-      } while (left > 0);
+
+      } while (left > 0 && g_atomic_int_get (&abuf->running));
 
       /* Update timestamp on buffer if required */
       gst_audio_ring_buffer_set_timestamp (buf, readseg, timestamp);