From 72504eee99f88e1a87ba16ab3ef9ff75962680cb Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Sat, 27 Jul 2019 05:14:28 +0200 Subject: [PATCH] rtsp-client: define all seek accuracy flags from setup_play_mode We then pass those to adjust_play_mode, which needs to operate on the "final" seek flags, as previously the code in rtsp-media was assuming that accuracy seek flags (accurate / key_unit) should not be set if the flags passed to the seek method were already set. --- gst/rtsp-server/rtsp-client.c | 6 ++++++ gst/rtsp-server/rtsp-media.c | 15 ++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index ec608815d6..964e06bfeb 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -1862,7 +1862,13 @@ setup_play_mode (GstRTSPClient * client, GstRTSPContext * ctx, flags = GST_SEEK_FLAG_KEY_UNIT & GST_SEEK_FLAG_SNAP_AFTER; else GST_FIXME_OBJECT (client, "Add support for seek style %s", seek_style); + } else if (range->min.type == GST_RTSP_TIME_END) { + flags = GST_SEEK_FLAG_ACCURATE; + } else { + flags = GST_SEEK_FLAG_KEY_UNIT; } + } else { + flags = GST_SEEK_FLAG_ACCURATE; } /* check for scale and/or speed headers diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c index a4124811cb..bc5458b29a 100644 --- a/gst/rtsp-server/rtsp-media.c +++ b/gst/rtsp-server/rtsp-media.c @@ -243,6 +243,8 @@ static gboolean check_complete (GstRTSPMedia * media); #define C_ENUM(v) ((gint) v) +#define TRICKMODE_FLAGS (GST_SEEK_FLAG_TRICKMODE | GST_SEEK_FLAG_TRICKMODE_KEY_UNITS | GST_SEEK_FLAG_TRICKMODE_FORWARD_PREDICTED) + GType gst_rtsp_suspend_mode_get_type (void) { @@ -2757,13 +2759,11 @@ gst_rtsp_media_seek_trickmode (GstRTSPMedia * media, if (stop != GST_CLOCK_TIME_NONE) stop_type = GST_SEEK_TYPE_SET; - /* we force a seek if any seek flag is set, or if the the rate + /* we force a seek if any trickmode flag is set, or if the rate * is non-standard, i.e. not 1.0 */ - force_seek = flags != GST_SEEK_FLAG_NONE || rate != 1.0; + force_seek = (flags & TRICKMODE_FLAGS) || rate != 1.0; if (start != GST_CLOCK_TIME_NONE || stop != GST_CLOCK_TIME_NONE || force_seek) { - gboolean had_flags = flags != GST_SEEK_FLAG_NONE; - GST_INFO ("seeking to %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (stop)); @@ -2782,14 +2782,7 @@ gst_rtsp_media_seek_trickmode (GstRTSPMedia * media, GST_TIME_ARGS (current_position)); start = current_position; start_type = GST_SEEK_TYPE_SET; - if (!had_flags) - flags |= GST_SEEK_FLAG_ACCURATE; } - } else { - /* only set keyframe flag when modifying start */ - if (start_type != GST_SEEK_TYPE_NONE) - if (!had_flags) - flags |= GST_SEEK_FLAG_KEY_UNIT; } if (start == current_position && stop_type == GST_SEEK_TYPE_NONE &&