GNOME Bugzilla – Bug 764055
gst_event_new_seek
Last modified: 2016-05-22 16:56:35 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.
/* 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); }
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?
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/.
What kind of media files? Container format and codecs. Does it also happen with GStreamer on another platform? Can you provide a debug log?
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!!
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
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 ?
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); }
The behaviour should be exactly the same on Linux as on Android/iOS here. Can you provide a log?
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!