Skip to content

Commit 46ca013

Browse files
alexandre-janniauxfkuehne
authored andcommitted
test: image: check that encoder opened
The test can pass if a different encoder is used during the test, but we need to ensure it's really the encoder from the test. This was catched when changing the capability from video encoder into image encoder, which led the test to use the png encoder instead.
1 parent 66f60e1 commit 46ca013

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/src/misc/image.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ const char vlc_module_name[] = MODULE_STRING;
4444

4545
#include <limits.h>
4646

47+
static atomic_bool encoder_opened = false;
48+
4749
static int OpenIntf(vlc_object_t *root)
4850
{
4951
image_handler_t *ih = image_HandlerCreate(root);
@@ -68,15 +70,18 @@ static int OpenIntf(vlc_object_t *root)
6870
assert(block != NULL);
6971
block_Release(block);
7072
picture_Release(picture);
73+
assert(atomic_load(&encoder_opened));
74+
atomic_store(&encoder_opened, false);
7175

7276
picture = picture_NewFromFormat(&fmt_in);
7377
fmt_out.i_width = fmt_out.i_visible_width = 400;
7478
fmt_out.i_height = fmt_out.i_visible_height = 300;
7579
block = image_Write(ih, picture, &fmt_in, &fmt_out);
7680
assert(block != NULL);
77-
7881
block_Release(block);
7982
picture_Release(picture);
83+
assert(atomic_load(&encoder_opened));
84+
8085
image_HandlerDelete(ih);
8186

8287
return VLC_SUCCESS;
@@ -98,6 +103,7 @@ static int OpenEncoder(vlc_object_t *obj)
98103
.encode_video = EncodeVideo
99104
};
100105
encoder->ops = &ops;
106+
atomic_store(&encoder_opened, true);
101107
return VLC_SUCCESS;
102108
}
103109

0 commit comments

Comments
 (0)