After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764055 - gst_event_new_seek
gst_event_new_seek
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
unspecified
Other Windows
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-23 08:24 UTC by ShengyiLiu
Modified: 2016-05-22 16:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description ShengyiLiu 2016-03-23 08:24:42 UTC
http://docs.gstreamer.com/display/GstSDK/Basic+tutorial+13%3A+Playback+speed


when use gst_event_new_seek to set rate between 0 and 1 in android or ios ,the play position  jump a big step.
Comment 1 ShengyiLiu 2016-03-23 08:28:32 UTC
/* Send seek event to change rate */
static void gst_set_rate (JNIEnv* env,jobject thiz, jdouble rate) {
    gint64 position;
    GstEvent *seek_event;

	CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id);
	if (!data)
		return ;

    /* Obtain the current position, needed for the seek event */
    if (!gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position)) {
        LOG_ERROR("Unable to retrieve current position.\n");
        return;
    }

    gint desired_position=position/GST_MSECOND;
    LOG_INFO("send_seek_event position:%d\n",desired_position);

    /* Create the seek event */
    if (rate> 0) {
        seek_event = gst_event_new_seek (rate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
                                         GST_SEEK_TYPE_SET, position, GST_SEEK_TYPE_SET, -1);
    } else {
        seek_event = gst_event_new_seek (rate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
        		GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, position);
    }

    if (data->video_sink == NULL) {
        g_object_get (data->pipeline, "video-sink", &data->video_sink, NULL);
    }

    /* Send the event */
    gst_element_send_event (data->video_sink, seek_event);

    LOG_INFO("send_seek_event rate:%f\n",rate);
}
Comment 2 Sebastian Dröge (slomo) 2016-03-23 08:32:15 UTC
gstreamer.com is unrelated to the GStreamer project and provides completely outdated versions of GStreamer. Does this problem still persist with 1.6.3 from https://gstreamer.freedesktop.org/data/pkg/ios/1.6.3/ ?

You can find their tutorials ported to 1.x here https://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/


What kind of media file is this and are you playing it from a local file or HTTP or which protocol?
Comment 3 ShengyiLiu 2016-03-23 08:56:26 UTC
Dear Sebastian:

  Thank you for your reply.
  This problem still persist with 1.7.2.
  And the media file is from a local file.
  And  this problem still persist when I use tutorials ported to 1.x  from https://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/.
Comment 4 Sebastian Dröge (slomo) 2016-03-23 09:15:55 UTC
What kind of media files? Container format and codecs.

Does it also happen with GStreamer on another platform? Can you provide a debug log?
Comment 5 ShengyiLiu 2016-03-23 10:15:12 UTC
Dear Sebastian: 
   Mp3 and Mkv hava the same problem.

   mkv: container: Matroska
        audio: Vorbis
        video: RealVideo 4.0

   It happens with GStreamer on android and ios.

   There is no error.  I  will give you the debug log tomorrow(not in company  now).

  Thanks again!!
Comment 6 Sebastian Dröge (slomo) 2016-03-23 10:41:12 UTC
Then it should also be reproducible on Linux/Windows/OSX. If you can make a small commandline testcase for this and provide a sample file that would be great. You can base that sample on https://github.com/sdroege/gst-snippets/blob/master/app.c
Comment 7 ShengyiLiu 2016-03-24 03:44:34 UTC
Hi Sebastian: 

  I test the demo(https://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/tree/gst-sdk/tutorials/basic-tutorial-13.c) on ubuntu , it do not happen when I set rate between 0 and 1. It may be happen only on android and ios ?
Comment 8 ShengyiLiu 2016-03-24 03:48:47 UTC
 I only add the code to the demo (https://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/tree/gst-sdk/tutorials/android-tutorial-5).

/* Send seek event to change rate */
static void gst_set_rate (JNIEnv* env,jobject thiz, jdouble rate) {
    gint64 position;
    GstEvent *seek_event;

	CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id);
	if (!data)
		return ;

    /* Obtain the current position, needed for the seek event */
    if (!gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position)) {
        LOG_ERROR("Unable to retrieve current position.\n");
        return;
    }

    gint desired_position=position/GST_MSECOND;
    LOG_INFO("send_seek_event position:%d\n",desired_position);

    /* Create the seek event */
    if (rate> 0) {
        seek_event = gst_event_new_seek (rate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
                                         GST_SEEK_TYPE_SET, position, GST_SEEK_TYPE_SET, -1);
    } else {
        seek_event = gst_event_new_seek (rate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
        		GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, position);
    }

    if (data->video_sink == NULL) {
        g_object_get (data->pipeline, "video-sink", &data->video_sink, NULL);
    }

    /* Send the event */
    gst_element_send_event (data->video_sink, seek_event);

    LOG_INFO("send_seek_event rate:%f\n",rate);
}
Comment 9 Sebastian Dröge (slomo) 2016-03-24 08:29:28 UTC
The behaviour should be exactly the same on Linux as on Android/iOS here. Can you provide a log?
Comment 10 Tim-Philipp Müller 2016-05-22 16:56:35 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug report if you can provide the information that was asked for in a previous comment.
Thanks!