Skip to content

Commit

Permalink
Lookup renderer in video codec test
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming committed Jan 3, 2025
1 parent 8abba1c commit 24852bb
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions pjmedia/src/test/vid_codec_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ static int encode_decode_test(pj_pool_t *pool, const char *codec_id,
char codec_name[5];
pj_status_t status;
int rc = 0;
unsigned i, count;

switch (packing) {
case PJMEDIA_VID_PACKING_PACKETS:
Expand Down Expand Up @@ -268,10 +269,28 @@ static int encode_decode_test(pj_pool_t *pool, const char *codec_id,
cap_idx = CAPTURE_DEV;
#endif

/* Lookup SDL renderer */
status = pjmedia_vid_dev_lookup("SDL", "SDL renderer", &rdr_idx);
if (status != PJ_SUCCESS) {
rc = 207; goto on_return;
/* Lookup renderer */
rdr_idx = PJMEDIA_VID_INVALID_DEV;
count = pjmedia_vid_dev_count();
for (i = 0; i < count; ++i) {
pjmedia_vid_dev_info cdi;

status = pjmedia_vid_dev_get_info(i, &cdi);
if (status != PJ_SUCCESS)
rc = 211; goto on_return;

/* Only interested with render device */
if ((cdi.dir & PJMEDIA_DIR_RENDER) != 0) {
rdr_idx = i;
break;
}
}
if (rdr_idx == PJMEDIA_VID_INVALID_DEV) {
PJ_LOG(3, (THIS_FILE, "Unable to find renderer device"));
/* We may be on a machine that doesn't have access to a renderer
* device, don't fail the test.
*/
rc = 0; goto on_return;
}

/* Prepare codec */
Expand Down

0 comments on commit 24852bb

Please sign in to comment.