diff options
author | Edward Hervey <bilboed@bilboed.com> | 2009-09-03 17:33:28 +0200 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2009-09-03 17:40:20 +0200 |
commit | 65d90baf8441c71a67a6b0bd7d6f340821653269 (patch) | |
tree | b620bcbe38f0124808ccc970b75d82580c0f2d72 /ext | |
parent | 272683ff369753c3efc96ee0eb876164863628fc (diff) |
jpegdec: Avoid unnecessary processing until we have a full picture.
This is for non-packetized mode, when we know the upstream size in bytes.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/jpeg/gstjpegdec.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c index a7312bae..e040342f 100644 --- a/ext/jpeg/gstjpegdec.c +++ b/ext/jpeg/gstjpegdec.c @@ -872,6 +872,18 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf) } buf = NULL; + /* If we are non-packetized and know the total incoming size in bytes, + * just wait until we have enough before doing any processing. */ + + if (!dec->packetized && (dec->segment.format == GST_FORMAT_BYTES) && + (dec->segment.stop != -1) && + (GST_BUFFER_SIZE (dec->tempbuf) < dec->segment.stop)) { + /* We assume that non-packetized input in bytes is *one* single jpeg image */ + GST_DEBUG ("Non-packetized mode. Got %d bytes, need %d", + GST_BUFFER_SIZE (dec->tempbuf), dec->segment.stop); + goto need_more_data; + } + if (!gst_jpeg_dec_ensure_header (dec)) goto need_more_data; |