summaryrefslogtreecommitdiff
path: root/tests/check/elements/videorate.c
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-01-23 19:08:15 +0000
committerTim-Philipp Müller <tim@centricular.com>2017-01-24 01:04:39 +0000
commitd6c0e9072b4a16c672ffb638befebc66df8d900c (patch)
tree183daee05202e6a73d500bd567d31207f61f74e4 /tests/check/elements/videorate.c
parent83e84d5acf4721b29aa498d51862e76d30b4fb34 (diff)
downloadgstreamer-plugins-base-d6c0e9072b4a16c672ffb638befebc66df8d900c.tar.gz
videorate: fix duration and position query handling
Duration query would return TRUE and duration=-1. This worked in the unit test because the unit test implementation was a bit broken. Both queries need to access rate with a lock. Fix broken duration query test as well. It relied on broken behaviour by the videorate query handler, and also it was implemented as a downstream query rather than an upstream query. And we must return HANDLED from the probe so that the query we intercept actually returns TRUE. https://bugzilla.gnome.org/show_bug.cgi?id=699077
Diffstat (limited to 'tests/check/elements/videorate.c')
-rw-r--r--tests/check/elements/videorate.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/check/elements/videorate.c b/tests/check/elements/videorate.c
index 132f9c1ad..7db55199a 100644
--- a/tests/check/elements/videorate.c
+++ b/tests/check/elements/videorate.c
@@ -1287,6 +1287,7 @@ listen_sink_query_duration (GstPad * pad, GstPadProbeInfo * info,
if (GST_QUERY_TYPE (query) == GST_QUERY_DURATION) {
gst_query_set_duration (query, GST_FORMAT_TIME, *duration);
+ return GST_PAD_PROBE_HANDLED;
}
return GST_PAD_PROBE_OK;
}
@@ -1304,12 +1305,12 @@ GST_START_TEST (test_query_duration)
"could not set to playing");
probe_sink =
gst_pad_add_probe (mysrcpad,
- GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_PUSH,
+ GST_PAD_PROBE_TYPE_QUERY_UPSTREAM,
(GstPadProbeCallback) listen_sink_query_duration, &duration, NULL);
query = gst_query_new_duration (GST_FORMAT_TIME);
duration = GST_CLOCK_TIME_NONE;
- gst_pad_peer_query (mysrcpad, query);
+ gst_pad_peer_query (mysinkpad, query);
gst_query_parse_duration (query, NULL, &duration);
fail_unless_equals_uint64 (duration, GST_CLOCK_TIME_NONE);
@@ -1319,7 +1320,7 @@ GST_START_TEST (test_query_duration)
/* Setting rate to 2.0 */
g_object_set (videorate, "rate", 2.0, NULL);
- gst_pad_peer_query (mysrcpad, query);
+ gst_pad_peer_query (mysinkpad, query);
gst_query_parse_duration (query, NULL, &duration);
fail_unless_equals_uint64 (duration, 0.5 * GST_SECOND);