ImagingSectionEnter for WebPAnimEncoder

This commit is contained in:
Aleksandr Karpinskii 2024-09-03 13:47:31 +04:00
parent 8bb3134b1d
commit 0962b468b7

View File

@ -190,6 +190,7 @@ _anim_encoder_add(PyObject *self, PyObject *args) {
float quality_factor; float quality_factor;
float alpha_quality_factor; float alpha_quality_factor;
int method; int method;
ImagingSectionCookie cookie;
WebPConfig config; WebPConfig config;
WebPAnimEncoderObject *encp = (WebPAnimEncoderObject *)self; WebPAnimEncoderObject *encp = (WebPAnimEncoderObject *)self;
WebPAnimEncoder *enc = encp->enc; WebPAnimEncoder *enc = encp->enc;
@ -246,8 +247,11 @@ _anim_encoder_add(PyObject *self, PyObject *args) {
WebPPictureImportRGB(frame, rgb, 3 * width); WebPPictureImportRGB(frame, rgb, 3 * width);
} }
// Add the frame to the encoder ImagingSectionEnter(&cookie);
if (!WebPAnimEncoderAdd(enc, frame, timestamp, &config)) { int ok = WebPAnimEncoderAdd(enc, frame, timestamp, &config);
ImagingSectionLeave(&cookie);
if (!ok) {
PyErr_SetString(PyExc_RuntimeError, WebPAnimEncoderGetError(enc)); PyErr_SetString(PyExc_RuntimeError, WebPAnimEncoderGetError(enc));
return NULL; return NULL;
} }