mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
tests: fix skipped rganalysis tests
In 0.10 elements would post tag messages on the bus directly, and rganalysis would only post a tag message when it changed tags. In 1.0, only sinks post tag messages when they receive the serialised tag event. This means that we get an additional tag message on the bus now where we didn't expect one before. https://bugzilla.gnome.org/show_bug.cgi?id=695090
This commit is contained in:
parent
1971c43279
commit
92dde0760b
1 changed files with 66 additions and 19 deletions
|
@ -320,11 +320,8 @@ poll_eos (GstElement * element)
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This also polls for EOS since the TAG message comes right before the end of
|
|
||||||
* streams. */
|
|
||||||
|
|
||||||
static GstTagList *
|
static GstTagList *
|
||||||
poll_tags (GstElement * element)
|
poll_tags_only (GstElement * element)
|
||||||
{
|
{
|
||||||
GstBus *bus = gst_element_get_bus (element);
|
GstBus *bus = gst_element_get_bus (element);
|
||||||
GstTagList *tag_list;
|
GstTagList *tag_list;
|
||||||
|
@ -337,6 +334,17 @@ poll_tags (GstElement * element)
|
||||||
gst_message_unref (message);
|
gst_message_unref (message);
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
|
|
||||||
|
return tag_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This also polls for EOS since the TAG message comes right before the end of
|
||||||
|
* streams. */
|
||||||
|
|
||||||
|
static GstTagList *
|
||||||
|
poll_tags (GstElement * element)
|
||||||
|
{
|
||||||
|
GstTagList *tag_list = poll_tags_only (element);
|
||||||
|
|
||||||
poll_eos (element);
|
poll_eos (element);
|
||||||
|
|
||||||
return tag_list;
|
return tag_list;
|
||||||
|
@ -1243,8 +1251,13 @@ GST_START_TEST (test_forced)
|
||||||
for (i = 20; i--;)
|
for (i = 20; i--;)
|
||||||
push_buffer (test_buffer_const_float_stereo (44100, 512, 0.5, 0.5));
|
push_buffer (test_buffer_const_float_stereo (44100, 512, 0.5, 0.5));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
|
||||||
/* This fails if a tag message is generated: */
|
/* This fails if a tag message is generated: */
|
||||||
poll_eos (element);
|
/* Same values as above */
|
||||||
|
tag_list = poll_tags (element);
|
||||||
|
fail_unless_track_gain (tag_list, 2.21);
|
||||||
|
fail_unless_track_peak (tag_list, 1.0);
|
||||||
|
gst_tag_list_unref (tag_list);
|
||||||
|
|
||||||
/* Now back to a track without tags. */
|
/* Now back to a track without tags. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
@ -1292,8 +1305,15 @@ GST_START_TEST (test_forced_separate)
|
||||||
push_buffer (test_buffer_square_float_stereo (&accumulator, 44100, 512,
|
push_buffer (test_buffer_square_float_stereo (&accumulator, 44100, 512,
|
||||||
0.5, 0.5));
|
0.5, 0.5));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
/* This fails if a tag message is generated: */
|
|
||||||
poll_eos (element);
|
/* Same values as above */
|
||||||
|
tag_list = poll_tags_only (element);
|
||||||
|
fail_unless_track_gain (tag_list, 2.21);
|
||||||
|
gst_tag_list_unref (tag_list);
|
||||||
|
|
||||||
|
tag_list = poll_tags (element);
|
||||||
|
fail_unless_track_peak (tag_list, 1.0);
|
||||||
|
gst_tag_list_unref (tag_list);
|
||||||
|
|
||||||
/* Now a track without tags. */
|
/* Now a track without tags. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
@ -1342,7 +1362,12 @@ GST_START_TEST (test_forced_after_data)
|
||||||
send_tag_event (element, tag_list);
|
send_tag_event (element, tag_list);
|
||||||
|
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
poll_eos (element);
|
|
||||||
|
/* Same values as above */
|
||||||
|
tag_list = poll_tags (element);
|
||||||
|
fail_unless_track_gain (tag_list, 2.21);
|
||||||
|
fail_unless_track_peak (tag_list, 1.0);
|
||||||
|
gst_tag_list_unref (tag_list);
|
||||||
|
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
|
@ -1388,8 +1413,12 @@ GST_START_TEST (test_forced_album)
|
||||||
push_buffer (test_buffer_square_float_stereo (&accumulator, 44100, 512,
|
push_buffer (test_buffer_square_float_stereo (&accumulator, 44100, 512,
|
||||||
0.5, 0.5));
|
0.5, 0.5));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
/* This fails if a tag message is generated: */
|
|
||||||
poll_eos (element);
|
/* Same values as above */
|
||||||
|
tag_list = poll_tags (element);
|
||||||
|
fail_unless_track_gain (tag_list, 2.21);
|
||||||
|
fail_unless_track_peak (tag_list, 1.0);
|
||||||
|
gst_tag_list_unref (tag_list);
|
||||||
|
|
||||||
/* Now an album without tags. */
|
/* Now an album without tags. */
|
||||||
g_object_set (element, "num-tracks", 2, NULL);
|
g_object_set (element, "num-tracks", 2, NULL);
|
||||||
|
@ -1452,7 +1481,13 @@ GST_START_TEST (test_forced_album_skip)
|
||||||
push_buffer (test_buffer_square_float_stereo (&accumulator, 8000, 512, 0.25,
|
push_buffer (test_buffer_square_float_stereo (&accumulator, 8000, 512, 0.25,
|
||||||
0.25));
|
0.25));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
poll_eos (element);
|
|
||||||
|
/* Same values as above */
|
||||||
|
tag_list = poll_tags (element);
|
||||||
|
fail_unless_track_gain (tag_list, 2.21);
|
||||||
|
fail_unless_track_peak (tag_list, 0.75);
|
||||||
|
gst_tag_list_unref (tag_list);
|
||||||
|
|
||||||
fail_unless_num_tracks (element, 1);
|
fail_unless_num_tracks (element, 1);
|
||||||
|
|
||||||
/* This track has no tags, but needs to be skipped anyways since we
|
/* This track has no tags, but needs to be skipped anyways since we
|
||||||
|
@ -1521,6 +1556,14 @@ GST_START_TEST (test_forced_album_no_skip)
|
||||||
for (i = 20; i--;)
|
for (i = 20; i--;)
|
||||||
push_buffer (test_buffer_const_float_stereo (8000, 512, 0.0, 0.0));
|
push_buffer (test_buffer_const_float_stereo (8000, 512, 0.0, 0.0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
|
||||||
|
/* the first batch from the tags */
|
||||||
|
tag_list = poll_tags_only (element);
|
||||||
|
fail_unless_track_peak (tag_list, 0.75);
|
||||||
|
fail_unless_track_gain (tag_list, 2.21);
|
||||||
|
gst_tag_list_unref (tag_list);
|
||||||
|
|
||||||
|
/* the second from the processing */
|
||||||
tag_list = poll_tags (element);
|
tag_list = poll_tags (element);
|
||||||
fail_unless_track_peak (tag_list, 0.0);
|
fail_unless_track_peak (tag_list, 0.0);
|
||||||
fail_unless_track_gain (tag_list, SILENCE_GAIN);
|
fail_unless_track_gain (tag_list, SILENCE_GAIN);
|
||||||
|
@ -1578,7 +1621,11 @@ GST_START_TEST (test_forced_abort_album_no_skip)
|
||||||
for (i = 20; i--;)
|
for (i = 20; i--;)
|
||||||
push_buffer (test_buffer_const_float_stereo (8000, 512, 0.0, 0.0));
|
push_buffer (test_buffer_const_float_stereo (8000, 512, 0.0, 0.0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
poll_eos (element);
|
|
||||||
|
tag_list = poll_tags (element);
|
||||||
|
fail_unless_track_peak (tag_list, 0.75);
|
||||||
|
fail_unless_track_gain (tag_list, 2.21);
|
||||||
|
gst_tag_list_unref (tag_list);
|
||||||
|
|
||||||
cleanup_rganalysis (element);
|
cleanup_rganalysis (element);
|
||||||
}
|
}
|
||||||
|
@ -1874,13 +1921,13 @@ rganalysis_suite (void)
|
||||||
|
|
||||||
tcase_add_test (tc_chain, test_gain_album);
|
tcase_add_test (tc_chain, test_gain_album);
|
||||||
|
|
||||||
tcase_skip_broken_test (tc_chain, test_forced);
|
tcase_add_test (tc_chain, test_forced);
|
||||||
tcase_skip_broken_test (tc_chain, test_forced_separate);
|
tcase_add_test (tc_chain, test_forced_separate);
|
||||||
tcase_skip_broken_test (tc_chain, test_forced_after_data);
|
tcase_add_test (tc_chain, test_forced_after_data);
|
||||||
tcase_skip_broken_test (tc_chain, test_forced_album);
|
tcase_add_test (tc_chain, test_forced_album);
|
||||||
tcase_skip_broken_test (tc_chain, test_forced_album_skip);
|
tcase_add_test (tc_chain, test_forced_album_skip);
|
||||||
tcase_skip_broken_test (tc_chain, test_forced_album_no_skip);
|
tcase_add_test (tc_chain, test_forced_album_no_skip);
|
||||||
tcase_skip_broken_test (tc_chain, test_forced_abort_album_no_skip);
|
tcase_add_test (tc_chain, test_forced_abort_album_no_skip);
|
||||||
|
|
||||||
tcase_add_test (tc_chain, test_reference_level);
|
tcase_add_test (tc_chain, test_reference_level);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue