mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
validate: Verify that elements always send a segment before pushing EOS
EOS is some kind of data flow and thus a segment event should always be pushed before the EOS is sent
This commit is contained in:
parent
23d7df3788
commit
6d0930bb36
2 changed files with 58 additions and 2 deletions
|
@ -1588,7 +1588,7 @@ gst_validate_pad_monitor_downstream_event_check (GstValidatePadMonitor *
|
|||
pad_monitor->pending_newsegment_seqnum = 0;
|
||||
} else {
|
||||
GST_VALIDATE_REPORT (pad_monitor, EVENT_HAS_WRONG_SEQNUM,
|
||||
"The expected EOS seqnum should be the same as the "
|
||||
"The expected segment seqnum should be the same as the "
|
||||
"one from the seek that caused it. Got: %u."
|
||||
" Expected: %u", seqnum, pad_monitor->pending_eos_seqnum);
|
||||
}
|
||||
|
@ -1630,7 +1630,11 @@ gst_validate_pad_monitor_downstream_event_check (GstValidatePadMonitor *
|
|||
}
|
||||
case GST_EVENT_EOS:
|
||||
pad_monitor->is_eos = TRUE;
|
||||
if (pad_monitor->pending_eos_seqnum != seqnum) {
|
||||
if (pad_monitor->pending_eos_seqnum == 0) {
|
||||
GST_VALIDATE_REPORT (pad_monitor, EVENT_EOS_WITHOUT_SEGMENT,
|
||||
"EOS %" GST_PTR_FORMAT " received before a segment was received",
|
||||
event);
|
||||
} else if (pad_monitor->pending_eos_seqnum != seqnum) {
|
||||
GST_VALIDATE_REPORT (pad_monitor, EVENT_HAS_WRONG_SEQNUM,
|
||||
"The expected EOS seqnum should be the same as the "
|
||||
"one from the seek that caused it. Got: %u."
|
||||
|
|
|
@ -799,6 +799,57 @@ GST_START_TEST (check_media_info)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (eos_without_segment)
|
||||
{
|
||||
GstPad *srcpad, *sinkpad;
|
||||
GstValidateReport *report;
|
||||
GstElement *decoder = fake_decoder_new ();
|
||||
GstElement *sink = gst_element_factory_make ("fakesink", NULL);
|
||||
GstBin *pipeline = GST_BIN (gst_pipeline_new ("validate-pipeline"));
|
||||
GList *reports;
|
||||
GstValidateRunner *runner;
|
||||
GstValidateMonitor *monitor;
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "all", TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
monitor =
|
||||
gst_validate_monitor_factory_create (GST_OBJECT (pipeline),
|
||||
runner, NULL);
|
||||
|
||||
gst_bin_add_many (pipeline, decoder, sink, NULL);
|
||||
srcpad = gst_pad_new ("srcpad1", GST_PAD_SRC);
|
||||
sinkpad = decoder->sinkpads->data;
|
||||
gst_pad_link (srcpad, sinkpad);
|
||||
|
||||
gst_element_link (decoder, sink);
|
||||
fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline),
|
||||
GST_STATE_PLAYING), GST_STATE_CHANGE_ASYNC);
|
||||
fail_unless (gst_pad_activate_mode (srcpad, GST_PAD_MODE_PUSH, TRUE));
|
||||
|
||||
reports = gst_validate_runner_get_reports (runner);
|
||||
assert_equals_int (g_list_length (reports), 0);
|
||||
g_list_free_full (reports, (GDestroyNotify) gst_validate_report_unref);
|
||||
|
||||
fail_unless (gst_pad_push_event (srcpad, gst_event_new_eos ()));
|
||||
reports = gst_validate_runner_get_reports (runner);
|
||||
|
||||
/* Getting the issue on the srcpad -> decoder.sinkpad -> decoder->srcpad */
|
||||
assert_equals_int (g_list_length (reports), 3);
|
||||
report = reports->data;
|
||||
fail_unless_equals_int (report->level, GST_VALIDATE_REPORT_LEVEL_WARNING);
|
||||
fail_unless_equals_int (report->issue->issue_id, EVENT_EOS_WITHOUT_SEGMENT);
|
||||
clean_bus (GST_ELEMENT (pipeline));
|
||||
|
||||
g_list_free_full (reports, (GDestroyNotify) gst_validate_report_unref);
|
||||
|
||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
||||
check_destroyed (pipeline, NULL, NULL);
|
||||
check_destroyed (monitor, NULL, NULL);
|
||||
check_destroyed (runner, NULL, NULL);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
gst_validate_suite (void)
|
||||
{
|
||||
|
@ -814,6 +865,7 @@ gst_validate_suite (void)
|
|||
tcase_add_test (tc_chain, flow_aggregation);
|
||||
tcase_add_test (tc_chain, issue_concatenation);
|
||||
tcase_add_test (tc_chain, check_media_info);
|
||||
tcase_add_test (tc_chain, eos_without_segment);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue