media: only set keyframe flag when modifying start
authorWim Taymans <wtaymans@redhat.com>
Thu, 6 Feb 2014 08:48:05 +0000 (09:48 +0100)
committerWim Taymans <wtaymans@redhat.com>
Thu, 6 Feb 2014 08:48:05 +0000 (09:48 +0100)
Only set the keyframe flag when we modify the start position. The
keyframe flag should probably be ignored when no change is requested but
until we can claim this is all documented properly and all demuxer
implement this, avoid setting the flag.

See also https://bugzilla.gnome.org/show_bug.cgi?id=723075

gst/rtsp-server/rtsp-media.c

index 44fc8ea..40b31d1 100644 (file)
@@ -1487,7 +1487,6 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
 {
   GstRTSPMediaClass *klass;
   GstRTSPMediaPrivate *priv;
-  GstSeekFlags flags;
   gboolean res;
   GstClockTime start, stop;
   GstSeekType start_type, stop_type;
@@ -1520,10 +1519,6 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
   if (!priv->seekable)
     goto not_seekable;
 
-  /* depends on the current playing state of the pipeline. We might need to
-   * queue this until we get EOS. */
-  flags = GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT;
-
   start_type = stop_type = GST_SEEK_TYPE_NONE;
 
   if (!klass->convert_range (media, range, GST_RTSP_RANGE_NPT))
@@ -1546,6 +1541,8 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
     stop_type = GST_SEEK_TYPE_SET;
 
   if (start != GST_CLOCK_TIME_NONE || stop != GST_CLOCK_TIME_NONE) {
+    GstSeekFlags flags;
+
     GST_INFO ("seeking to %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT,
         GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
 
@@ -1553,6 +1550,15 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
     if (priv->blocked)
       media_streams_set_blocked (media, TRUE);
 
+    /* depends on the current playing state of the pipeline. We might need to
+     * queue this until we get EOS. */
+    flags = GST_SEEK_FLAG_FLUSH;
+
+    /* only set keyframe flag when modifying start */
+    if (start_type != GST_SEEK_TYPE_NONE)
+      flags |= GST_SEEK_FLAG_KEY_UNIT;
+
+    /* FIXME, we only do forwards */
     res = gst_element_seek (priv->pipeline, 1.0, GST_FORMAT_TIME,
         flags, start_type, start, stop_type, stop);