diff options
author | Sebastian Rasmussen <sebrn@axis.com> | 2011-11-24 13:58:01 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-12-05 10:48:54 +0100 |
commit | c090201ca59f4d16df8af7390472b5eebfa86cab (patch) | |
tree | 3686cdd55113f607376c91ef0601e98557f325eb /gst/rtp | |
parent | 0249a73a3e134b4b0c61864484a1654a9130a836 (diff) |
rtpjpegpay: Ceil jpeg dimensions, instead of floor
A JPEG image inside an RTP stream has a preceeding RFC2435 header that
conveys width/height. The dimensions in this header are limited to be
multiples of 8. Since JPEG uses an MCU of 8x8 pixels any image must
already indirectly have image data dimensions that are rounded up in
order to contain enough data to render the image. Therefore this fix
safely rounds the image dimensions in the RFC2435 header up to the
closest multiple of 8.
Diffstat (limited to 'gst/rtp')
-rw-r--r-- | gst/rtp/gstrtpjpegpay.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gst/rtp/gstrtpjpegpay.c b/gst/rtp/gstrtpjpegpay.c index ff1fe7e12..eae2840f0 100644 --- a/gst/rtp/gstrtpjpegpay.c +++ b/gst/rtp/gstrtpjpegpay.c @@ -314,13 +314,13 @@ gst_rtp_jpeg_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps) if (height <= 0 || height > 2040) goto invalid_dimension; } - pay->height = height / 8; + pay->height = GST_ROUND_UP_8 (height) / 8; if (gst_structure_get_int (caps_structure, "width", &width)) { if (width <= 0 || width > 2040) goto invalid_dimension; } - pay->width = width / 8; + pay->width = GST_ROUND_UP_8 (width) / 8; gst_basertppayload_set_options (basepayload, "video", TRUE, "JPEG", 90000); res = gst_basertppayload_set_outcaps (basepayload, NULL); @@ -459,8 +459,8 @@ gst_rtp_jpeg_pay_read_sof (GstRtpJPEGPay * pay, const guint8 * data, if (width == 0 || width > 2040) goto invalid_dimension; - pay->height = height / 8; - pay->width = width / 8; + pay->height = GST_ROUND_UP_8 (height) / 8; + pay->width = GST_ROUND_UP_8 (width) / 8; /* we only support 3 components */ if (data[off++] != 3) |