From: Michael Smith Date: Wed, 15 Nov 2006 14:36:39 +0000 (+0000) Subject: gst/extend/discoverer.py: Avoid buffering infinite amounts of decoded data if a decod... X-Git-Tag: 1.19.3~485^2~740 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=26f5653a79a528c6df1ff52b233480e00cdab866;p=platform%2Fupstream%2Fgstreamer.git gst/extend/discoverer.py: Avoid buffering infinite amounts of decoded data if a decoder is feeding us data without a ... Original commit message from CVS: * gst/extend/discoverer.py: Avoid buffering infinite amounts of decoded data if a decoder is feeding us data without a duration (or with bad duration values). --- diff --git a/ChangeLog b/ChangeLog index 854c1a2..8f9a9c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-11-15 Michael Smith + + * gst/extend/discoverer.py: + Avoid buffering infinite amounts of decoded data if a decoder is + feeding us data without a duration (or with bad duration values). + 2006-11-07 Edward Hervey * gst/extend/discoverer.py: Make the queue buffer up 1s of data before diff --git a/gst/extend/discoverer.py b/gst/extend/discoverer.py index a061a5d..5e7db47 100644 --- a/gst/extend/discoverer.py +++ b/gst/extend/discoverer.py @@ -109,7 +109,7 @@ class Discoverer(gst.Pipeline): self._success = False self._timeoutid = 0 - + if not os.path.isfile(filename): self.finished = True return @@ -298,8 +298,19 @@ class Discoverer(gst.Pipeline): # stream. queue.props.min_threshold_time = 1 * gst.SECOND queue.props.max_size_time = 2 * gst.SECOND - queue.props.max_size_buffers = 0 queue.props.max_size_bytes = 0 + + # If durations are bad on the buffers (common for video decoders), we'll + # never reach the min_threshold_time or max_size_time. So, set a large + # max size in buffers, and if reached, disable the min_threshold_time. + # This ensures we don't fail to discover with various ffmpeg + # demuxers/decoders that provide bogus (or no) duration. + queue.props.max_size_buffers = 100 + def _disable_min_threshold_cb(queue): + queue.props.min_threshold_time = 0 + queue.disconnect(signal_id) + signal_id = queue.connect('overrun', _disable_min_threshold_cb) + self.add(fakesink, queue) queue.link(fakesink) sinkpad = fakesink.get_pad("sink")