Skip to content
Snippets Groups Projects
Commit 8758a175 authored by Alexandre Janniaux's avatar Alexandre Janniaux Committed by Jean-Baptiste Kempf
Browse files

test: video_output: fix test not ending correctly

The test was failing randomly because the decoder was asked to decode
more data and its output format was reset to VLC_CODEC_UNKNOWN, which is
not an allocatable format for picture_NewFromResource.

Abandon the picture allocation in decoder_decoder(dec, picture) callback
to let the scenario handle the allocation, and in particular discard it
if it already did the test. The new test_finished boolean will force the
decoder callback to no-op. It is a bit redundant with the display_opened
callback where it could loop doing the update until it is correctly
closed but much clearer.

I'm not sure yet, but it seems that the easiest method to control the
behaviour of the test is to have a custom demux to push data at will.
It's adding a lot of code and is trickier to manage so here we fix the
test first.

Fixes #26374
parent eca2d51b
No related branches found
No related tags found
1 merge request!1028test: video_output: fix test not ending correctly
Pipeline #168872 passed with stage
in 40 minutes and 19 seconds
......@@ -73,18 +73,9 @@ static int DecoderDecode(decoder_t *dec, block_t *block)
if (block == NULL)
return VLC_SUCCESS;
const picture_resource_t resource = {
.p_sys = NULL,
};
picture_t *pic = picture_NewFromResource(&dec->fmt_out.video, &resource);
assert(pic);
pic->date = block->i_pts;
pic->b_progressive = true;
block_Release(block);
struct vout_scenario *scenario = &vout_scenarios[current_scenario];
assert(scenario->decoder_decode != NULL);
scenario->decoder_decode(dec, pic);
scenario->decoder_decode(dec, block);
return VLC_SUCCESS;
}
......
......@@ -34,7 +34,7 @@
struct vout_scenario {
const char *source;
void (*decoder_setup)(decoder_t *);
void (*decoder_decode)(decoder_t *, picture_t *);
void (*decoder_decode)(decoder_t *, block_t *);
int (*display_setup)(vout_display_t *, video_format_t *,
struct vlc_video_context *);
void (*display_prepare)(vout_display_t *, picture_t *);
......
......@@ -41,6 +41,7 @@ static struct scenario_data
unsigned display_picture_count;
bool converter_opened;
bool display_opened;
bool test_finished;
vlc_fourcc_t display_chroma;
} scenario_data;
......@@ -62,8 +63,11 @@ static void decoder_fixed_size(decoder_t *dec, vlc_fourcc_t chroma,
static void decoder_rgba_800_600(decoder_t *dec)
{ decoder_fixed_size(dec, VLC_CODEC_RGBA, 800, 600); }
static void decoder_decode_change_chroma(decoder_t *dec, picture_t *pic)
static void decoder_decode_change_chroma(decoder_t *dec, block_t *block)
{
if (scenario_data.test_finished)
goto end;
static const vlc_fourcc_t chroma_list[] = {
VLC_CODEC_RGBA,
VLC_CODEC_I420,
......@@ -88,16 +92,26 @@ static void decoder_decode_change_chroma(decoder_t *dec, picture_t *pic)
= chroma_list[index];
int ret = decoder_UpdateVideoOutput(dec, NULL);
//assert(ret == VLC_SUCCESS);
if (ret != VLC_SUCCESS)
{
scenario_data.test_finished = true;
vlc_sem_post(&scenario_data.wait_stop);
return;
goto end;
}
const picture_resource_t resource = {
.p_sys = NULL,
};
picture_t *pic = picture_NewFromResource(&dec->fmt_out.video, &resource);
assert(pic);
pic->date = block->i_pts;
pic->b_progressive = true;
/* Simulate the chroma change */
pic->format.i_chroma = chroma_list[index];
decoder_QueueVideo(dec, pic);
end:
block_Release(block);
}
static int display_fixed_size(vout_display_t *vd, video_format_t *fmtp,
......@@ -122,6 +136,7 @@ static int display_fail_second_time(vout_display_t *vd, video_format_t *fmtp,
{
msg_Info(vd, "Failing the display %4.4s: %ux%u",
(const char *)&chroma, width, height);
scenario_data.test_finished = true;
return VLC_EGENERIC;
}
......@@ -149,6 +164,7 @@ void vout_scenario_init(void)
scenario_data.display_picture_count = 0;
scenario_data.converter_opened = false;
scenario_data.display_opened = false;
scenario_data.test_finished = false;
vlc_sem_init(&scenario_data.wait_stop, 0);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment