From ead80d894bc7667458df297e0bfec6011d916f49 Mon Sep 17 00:00:00 2001 From: totaam Date: Mon, 31 May 2021 10:35:56 +0700 Subject: [PATCH] #3031 remove unnecessary call to object_as_buffer --- xpra/codecs/nvjpeg/encoder.pyx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/xpra/codecs/nvjpeg/encoder.pyx b/xpra/codecs/nvjpeg/encoder.pyx index 44a82e0ec5..716e8ddf97 100644 --- a/xpra/codecs/nvjpeg/encoder.pyx +++ b/xpra/codecs/nvjpeg/encoder.pyx @@ -7,7 +7,7 @@ from libc.stdint cimport uintptr_t from xpra.monotonic_time cimport monotonic_time -from xpra.buffers.membuf cimport getbuf, MemBuf, object_as_buffer #pylint: disable=syntax-error +from xpra.buffers.membuf cimport getbuf, MemBuf #pylint: disable=syntax-error from pycuda import driver @@ -385,9 +385,7 @@ cdef do_device_encode(device, image, int quality, int speed): pixels = image.get_pixels() pfstr = bytestostr(image.get_pixel_format()) #pfstr = bytestostr(image.get_pixel_format()) - cdef const unsigned char* buf - cdef Py_ssize_t buf_len - assert object_as_buffer(pixels, &buf, &buf_len)==0, "unable to convert %s to a buffer" % type(pixels) + cdef Py_ssize_t buf_len = len(pixels) assert buf_len>=stride*height, "%s buffer is too small: %i bytes, %ix%i=%i bytes required" % (pfstr, buf_len, stride, height, stride*height) cdef double end = monotonic_time() log("prepared in %.1fms", 1000*(end-start))