Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2010-05-27 21:06:25 (GMT)
committer Daniel Drake <dsd@laptop.org>2010-05-27 21:06:25 (GMT)
commitf15b83863a802d1ccabd04f9b9f7ec6cd19d6f75 (patch)
tree7c7252026a4876c1199f486ce0e3c6cc51772e0c
parent7cd3274e0e12fcda8d12e17316280b057e014e2c (diff)
Bigger queues and overrun debugging
On XO-1, we quickly meet the limits of the default queue limits. Increase them both and add debugging to detect these conditions in future. This fixes A/V sync on XO-1.
-rw-r--r--glive.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/glive.py b/glive.py
index 6c51872..588896b 100644
--- a/glive.py
+++ b/glive.py
@@ -34,6 +34,7 @@ import gobject
gobject.threads_init()
from sugar.activity.activity import get_bundle_path
+import logging
from instance import Instance
from constants import Constants
@@ -41,6 +42,8 @@ import record
import utils
import ui
+logger = logging.getLogger('record:glive.py')
+
OGG_TRAITS = {
0: { 'width': 160, 'height': 120, 'quality': 16 },
1: { 'width': 400, 'height': 300, 'quality': 16 },
@@ -152,8 +155,11 @@ class Glive:
# recording and then the A/V sync is bad for the whole video
# (possibly a gstreamer/ALSA bug -- even if it gets caught up, it
# should be able to resync without problem)
- queue = gst.element_factory_make("queue")
+ queue = gst.element_factory_make("queue", "audioqueue")
queue.set_property("leaky", True) # prefer fresh data
+ queue.set_property("max-size-time", 5000000000) # 5 seconds
+ queue.set_property("max-size-buffers", 500)
+ queue.connect("overrun", self.log_queue_overrun)
enc = gst.element_factory_make("wavenc", "abenc")
@@ -167,7 +173,10 @@ class Glive:
gst.element_link_many(rate, queue, enc, sink)
def createVideoBin ( self ):
- queue = gst.element_factory_make("queue")
+ queue = gst.element_factory_make("queue", "videoqueue")
+ queue.set_property("max-size-time", 5000000000) # 5 seconds
+ queue.set_property("max-size-bytes", 33554432) # 32mb
+ queue.connect("overrun", self.log_queue_overrun)
scale = gst.element_factory_make("videoscale", "vbscale")
@@ -260,6 +269,13 @@ class Glive:
self.pipeline.add(cspace, xsink)
gst.element_link_many(queue, cspace, xsink)
+ def log_queue_overrun(self, queue):
+ cbuffers = queue.get_property("current-level-buffers")
+ cbytes = queue.get_property("current-level-bytes")
+ ctime = queue.get_property("current-level-time")
+ logger.error("Buffer overrun in %s (%d buffers, %d bytes, %d time)"
+ % (queue.get_name(), cbuffers, cbytes, ctime))
+
def thumbPipe(self):
return self.thumbPipes[ len(self.thumbPipes)-1 ]