GNOME Bugzilla – Bug 599389
Appsrc & playbin2 reading too much data,
Last modified: 2009-10-27 11:07:17 UTC
Hi, using version 0.10.23 of the base plugins, I am attempting to use appsrc & playbin2 to stream some music files. All works fine until I attempt to seek to a position in the song. I register my seek-data & need-data callbacks as follows: g_signal_connect (app->appsrc, "need-data", G_CALLBACK (feed_data), app); g_signal_connect (app->appsrc, "seek-data", G_CALLBACK (seek_data), app); I have a seek to time function which makes a call to gst_element_seek as follows: gst_element_seek (pipeline, 1.0, GST_FORMAT_TIME, (GstSeekFlags)GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, offset, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE) When I attempt to seek to a position, I see my call to seek-data called with the correct offset, my feed-data is then called as expected, but, I then see a massive loop of seek_data & feed_data. The amount of loops seems related to the position I am seeking to, i.e if I seek to byte 100 (Illustrative) I seek direct to byte 100 then read a further 100 bytes! If my file is only 150 bytes, I get an EOS and stop. Is this a bug or am I using these functions incorrectly? Thanks.
Have you set the 'stream-type' property on appsrc? stream-type : the type of the stream flags: readable, writable Enum "GstAppStreamType" Default: 0, "stream" Current: 0, "stream" (0): stream - Stream (1): seekable - Seekable (2): random-access - Random Access
I am using stream-type: "seekable". gst_util_set_object_arg (G_OBJECT (app->appsrc), "stream-type", "seekable"); I also tried "random-access" but can't even get a song to play, I get an error: internal data flow error. To be honest I havent played much with the random-access option.
did you try with the examples in gst-plugins-base/tests/examples/app/ ? the appsrc-ra.c example should show how to deal with random access sources. Reopen if those example fail for you.