diff --git a/ChangeLog b/ChangeLog index 854c1a279e..8f9a9c70a5 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 a061a5da98..5e7db475f6 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")