pulsesrc: Don't negotiate to less than two segments
authorArun Raghavan <arun@arunraghavan.net>
Thu, 8 Sep 2016 12:00:41 +0000 (17:30 +0530)
committerArun Raghavan <arun@arunraghavan.net>
Sat, 24 Sep 2016 19:50:14 +0000 (01:20 +0530)
GstAudioRingBuffer doesn't needs us to have at least 2 segments. We make
sure that if our buffer parameters are such that the maxlength is not at
least 2x fragsize, we still request the ringbuffer to keep that much
space so it continues to work.

https://bugzilla.gnome.org/show_bug.cgi?id=770446

ext/pulse/pulsesrc.c

index 6ee2c50..7af74ee 100644 (file)
@@ -1595,6 +1595,9 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
 
   /* Fix up the total ringbuffer size based on what we actually got */
   spec->segtotal = actual->maxlength / spec->segsize;
+  /* Don't buffer less than 2 segments as the ringbuffer can't deal with it */
+  if (spec->segtotal < 2)
+    spec->segtotal = 2;
 
   if (!pulsesrc->paused) {
     GST_DEBUG_OBJECT (pulsesrc, "uncorking because we are playing");