diff options
author | Branko Subasic <branko@subasic.net> | 2018-09-27 19:09:01 +0200 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2019-06-04 14:32:51 +0200 |
commit | 421ac851504812ad640c58f92c04123254905b9b (patch) | |
tree | 88e1b43742b63f1226a05207f4f3139af30f2e80 /tests/check | |
parent | e788fc4e88f727a77920d8ad2ef5fd4460d41ce0 (diff) |
rtsp-media: allow specifying rate when seeking
Add new function gst_rtsp_media_seek_full_with_rate() which allows the
caller to specify the rate for the seek. Also added functions in
rtsp-stream and rtsp-media for retreiving current rate and applied rate.
https://bugzilla.gnome.org/show_bug.cgi?id=754575
Diffstat (limited to 'tests/check')
-rw-r--r-- | tests/check/gst/media.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/check/gst/media.c b/tests/check/gst/media.c index 5ae704ce9b..bcde9c30f9 100644 --- a/tests/check/gst/media.c +++ b/tests/check/gst/media.c @@ -60,6 +60,8 @@ GST_START_TEST (test_media_seek) GstRTSPThreadPool *pool; GstRTSPThread *thread; GstRTSPTransport *transport; + gdouble rate = 0; + gdouble applied_rate = 0; factory = gst_rtsp_media_factory_new (); fail_if (gst_rtsp_media_factory_is_shared (factory)); @@ -98,9 +100,30 @@ GST_START_TEST (test_media_seek) str = gst_rtsp_media_get_range_string (media, FALSE, GST_RTSP_RANGE_NPT); fail_unless (g_str_equal (str, "npt=5-")); + g_free (str); + + /* seeking without rate should result in rate == 1.0 */ + fail_unless (gst_rtsp_media_seek (media, range)); + fail_unless (gst_rtsp_media_get_rates (media, &rate, &applied_rate)); + fail_unless (rate == 1.0); + fail_unless (applied_rate == 1.0); + + /* seeking with rate set to 1.5 should result in rate == 1.5 */ + fail_unless (gst_rtsp_media_seek_full_with_rate (media, range, + GST_SEEK_FLAG_NONE, 1.5)); + fail_unless (gst_rtsp_media_get_rates (media, &rate, &applied_rate)); + fail_unless (rate == 1.5); + fail_unless (applied_rate == 1.0); + + /* seeking with rate set to -2.0 should result in rate == -2.0 */ + fail_unless (gst_rtsp_range_parse ("npt=5-10", &range) == GST_RTSP_OK); + fail_unless (gst_rtsp_media_seek_full_with_rate (media, range, + GST_SEEK_FLAG_NONE, -2.0)); + fail_unless (gst_rtsp_media_get_rates (media, &rate, &applied_rate)); + fail_unless (rate == -2.0); + fail_unless (applied_rate == 1.0); gst_rtsp_range_free (range); - g_free (str); fail_unless (gst_rtsp_media_unprepare (media)); g_object_unref (media); |