diff options
author | Edward Hervey <edward@collabora.com> | 2013-03-28 19:07:30 +0100 |
---|---|---|
committer | Edward Hervey <edward@collabora.com> | 2013-03-28 19:07:30 +0100 |
commit | 692dc3c377a155b719de2eeb7c4c2697632e2dbc (patch) | |
tree | 55974626d4c5aa92bcb0bd7bec89ee44d44c9a20 /tests | |
parent | d459463192a2fd0afcdc4c6f5bd47d3aa1c37c44 (diff) |
We update it based on accumulated segment time.
Tests are also updated to check for valid base/time/duration
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/gnl/common.h | 27 | ||||
-rw-r--r-- | tests/check/gnl/complex.c | 3 | ||||
-rw-r--r-- | tests/check/gnl/gnloperation.c | 1 | ||||
-rw-r--r-- | tests/check/gnl/seek.c | 5 | ||||
-rw-r--r-- | tests/check/gnl/simple.c | 5 |
5 files changed, 30 insertions, 11 deletions
diff --git a/tests/check/gnl/common.h b/tests/check/gnl/common.h index 88f0a17..5ec207f 100644 --- a/tests/check/gnl/common.h +++ b/tests/check/gnl/common.h @@ -45,6 +45,7 @@ typedef struct _CollectStructure { gboolean gotsegment; GList *seen_segments; GList *expected_segments; + guint64 expected_base; } CollectStructure; static GstElement * @@ -66,33 +67,43 @@ composition_pad_added_cb (GstElement *composition, GstPad *pad, CollectStructure /* return TRUE to discard the Segment */ static gboolean -compare_segments (Segment * segment, GstEvent * event) +compare_segments (CollectStructure *collect, Segment * segment, GstEvent * event) { const GstSegment *orig; + guint64 running_stop, running_start, running_duration; gst_event_parse_segment (event, &orig); GST_DEBUG ("Got Segment rate:%f, format:%s, start:%"GST_TIME_FORMAT - ", stop:%"GST_TIME_FORMAT", position:%"GST_TIME_FORMAT + ", stop:%"GST_TIME_FORMAT", time:%"GST_TIME_FORMAT ", base:%"GST_TIME_FORMAT", offset:%"GST_TIME_FORMAT, orig->rate, gst_format_get_name(orig->format), GST_TIME_ARGS (orig->start), GST_TIME_ARGS (orig->stop), - GST_TIME_ARGS (orig->position), + GST_TIME_ARGS (orig->time), GST_TIME_ARGS (orig->base), GST_TIME_ARGS (orig->offset)); + GST_DEBUG ("[RUNNING] start:%"GST_TIME_FORMAT" [STREAM] start:%"GST_TIME_FORMAT, + GST_TIME_ARGS (gst_segment_to_running_time (orig, GST_FORMAT_TIME, orig->start)), + GST_TIME_ARGS (gst_segment_to_stream_time (orig, GST_FORMAT_TIME, orig->start))); GST_DEBUG ("Expecting rate:%f, format:%s, start:%"GST_TIME_FORMAT - ", stop:%"GST_TIME_FORMAT", position:%"GST_TIME_FORMAT, + ", stop:%"GST_TIME_FORMAT", position:%"GST_TIME_FORMAT", base:%"GST_TIME_FORMAT, segment->rate, gst_format_get_name (segment->format), GST_TIME_ARGS (segment->start), GST_TIME_ARGS (segment->stop), - GST_TIME_ARGS (segment->position)); + GST_TIME_ARGS (segment->position), + GST_TIME_ARGS (collect->expected_base)); + running_start = gst_segment_to_running_time (orig, GST_FORMAT_TIME, orig->start); + running_stop = gst_segment_to_running_time (orig, GST_FORMAT_TIME, orig->stop); + running_duration = running_stop - running_start; fail_if (orig->rate != segment->rate); fail_if (orig->format != segment->format); - fail_unless_equals_uint64 (orig->start, segment->start); - fail_unless_equals_uint64 (orig->stop, segment->stop); fail_unless_equals_int64 (orig->time, segment->position); + fail_unless_equals_int64 (orig->base, collect->expected_base); + fail_unless_equals_uint64 (orig->stop - orig->start, segment->stop -segment->start); + + collect->expected_base += running_duration; GST_DEBUG ("Segment was valid, discarding expected Segment"); @@ -121,7 +132,7 @@ sinkpad_event_probe (GstPad * sinkpad, GstEvent * event, CollectStructure * coll segment = (Segment *) collect->expected_segments->data; - if (compare_segments (segment, event)) { + if (compare_segments (collect, segment, event)) { collect->expected_segments = g_list_remove (collect->expected_segments, segment); g_free (segment); } diff --git a/tests/check/gnl/complex.c b/tests/check/gnl/complex.c index 14e830b..ee8aa07 100644 --- a/tests/check/gnl/complex.c +++ b/tests/check/gnl/complex.c @@ -75,6 +75,7 @@ fill_pipeline_and_check (GstElement * comp, GList * segments) collect->expected_segments = listcopy; collect->gotsegment = FALSE; + collect->expected_base = 0; GST_DEBUG ("Setting pipeline to PLAYING again"); @@ -582,7 +583,6 @@ GST_START_TEST (test_renegotiation) GST_DEBUG ("Resetted pipeline to READY"); /* Expected segments */ - /* Expected segments */ collect->expected_segments = g_list_append (collect->expected_segments, segment_new (1.0, GST_FORMAT_TIME, 0, 1 * GST_SECOND, 0)); collect->expected_segments = g_list_append (collect->expected_segments, @@ -592,6 +592,7 @@ GST_START_TEST (test_renegotiation) segment_new (1.0, GST_FORMAT_TIME, 2 * GST_SECOND, 3 * GST_SECOND, 2 * GST_SECOND)); collect->gotsegment = FALSE; + collect->expected_base = 0; GST_DEBUG ("Setting pipeline to PLAYING again"); diff --git a/tests/check/gnl/gnloperation.c b/tests/check/gnl/gnloperation.c index a91360c..e4499b9 100644 --- a/tests/check/gnl/gnloperation.c +++ b/tests/check/gnl/gnloperation.c @@ -73,6 +73,7 @@ fill_pipeline_and_check (GstElement * comp, GList * segments) GST_DEBUG ("Resetted pipeline to READY"); + collect->expected_base = 0; collect->expected_segments = listcopy; collect->gotsegment = FALSE; diff --git a/tests/check/gnl/seek.c b/tests/check/gnl/seek.c index 8689f90..07c2828 100644 --- a/tests/check/gnl/seek.c +++ b/tests/check/gnl/seek.c @@ -98,11 +98,14 @@ fill_pipeline_and_check (GstElement * comp, GList * segments, GList * seeks) seeks = seeks->next; - if (!sinfo->expect_failure) + if (!sinfo->expect_failure) { + collect->gotsegment = FALSE; + collect->expected_base = 0; collect->expected_segments = g_list_append (collect->expected_segments, segment_new (1.0, GST_FORMAT_TIME, sinfo->start, sinfo->stop, sinfo->position)); + } /* Seek to 0.5s */ GST_DEBUG ("Seeking to %" GST_TIME_FORMAT ", Expecting (%" diff --git a/tests/check/gnl/simple.c b/tests/check/gnl/simple.c index 0a11725..ba58f21 100644 --- a/tests/check/gnl/simple.c +++ b/tests/check/gnl/simple.c @@ -111,7 +111,8 @@ test_simplest_full (gboolean async) /* Expected segments */ collect->expected_segments = g_list_append (collect->expected_segments, segment_new (1.0, GST_FORMAT_TIME, 5 * GST_SECOND, 6 * GST_SECOND, 0)); - + collect->expected_base = 0; + collect->gotsegment = FALSE; GST_DEBUG ("Setting pipeline to PLAYING again"); @@ -392,6 +393,7 @@ test_one_after_other_full (gboolean async) segment_new (1.0, GST_FORMAT_TIME, 2 * GST_SECOND, 3 * GST_SECOND, 1 * GST_SECOND)); collect->gotsegment = FALSE; + collect->expected_base = 0; GST_DEBUG ("Setting pipeline to PLAYING again"); @@ -740,6 +742,7 @@ test_one_bin_after_other_full (gboolean async) segment_new (1.0, GST_FORMAT_TIME, 1 * GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND)); collect->gotsegment = FALSE; + collect->expected_base = 0; GST_DEBUG ("Setting pipeline to PLAYING again"); |