On Wed, Jul 06, 2011 at 12:32:53PM +0200, Christophe Fergeau wrote: > It's not used when we use jpeg-turbo colorspaces, so it's better > to allocate it when we know we'll need it rather than always > allocating it even if it won't be used.
Just one thing - you're turning an abort to a return FALSE. have you tested this? does it get handled correctly all the way up? > --- > server/mjpeg_encoder.c | 16 ++++++++-------- > 1 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c > index 8b323ed..7351dae 100644 > --- a/server/mjpeg_encoder.c > +++ b/server/mjpeg_encoder.c > @@ -27,7 +27,6 @@ > struct MJpegEncoder { > int width; > int height; > - int stride; > uint8_t *row; > int first_frame; > int quality; > @@ -48,15 +47,8 @@ MJpegEncoder *mjpeg_encoder_new(int width, int height) > enc->first_frame = TRUE; > enc->width = width; > enc->height = height; > - enc->stride = width * 3; > enc->quality = 70; > - if (enc->stride < width) { > - abort(); > - } > - enc->row = spice_malloc(enc->stride); > - > enc->cinfo.err = jpeg_std_error(&enc->jerr); > - > jpeg_create_compress(&enc->cinfo); > > return enc; > @@ -240,6 +232,14 @@ int mjpeg_encoder_start_frame(MJpegEncoder *encoder, > SpiceBitmapFmt format, > return FALSE; > } > > + if ((encoder->pixel_converter != NULL) && (encoder->row == NULL)) { > + unsigned int stride = encoder->width * 3; > + if (stride < encoder->width) { > + return FALSE; > + } > + encoder->row = spice_malloc(stride); > + } > + > jpeg_mem_dest(&encoder->cinfo, dest, dest_len); > > encoder->cinfo.image_width = encoder->width; > -- > 1.7.6 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/spice-devel _______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel