RTSP seek issue with custom client
suspension
manusha1980 at gmail.com
Sun Nov 1 11:57:00 PST 2015
Hi
I have set-up a generic gstreamer client using the below code. It accepts a
pipeline in the gst-launch format and runts the pipeline in a separate
thread. I have removed some code that are related to setting a custom window
handle because I thought it has nothing to do with the issue I am facing
now.
Basically, the run method spawns a separate thread which starts in the
function playback. This function uses the passed pipeline to create gst
pipeline and set its state to GST_STATE_READY. The thread that calls run
(which is the program's main thread) sets the pipeline status to playing
after pipeline is started. The same thread at a later time calls
gst_element_seek_simple with a valid time to seek the position. This call
almost always result in a hang in both the client and the server. However if
I use gst-play-1.0 as the client seek works. What am I doing wrong here?
void playback(int argc, char* argv[])
{
std::cerr << "starting loop thread" << std::endl;
GError* error = NULL;
/* init */
gst_init(&argc, &argv);
std::cerr << "gst init done" << std::endl;
loop = g_main_loop_new(NULL, FALSE);
if (loop == NULL) {
std::cerr << "Failed to create the main loop" << std::endl;
loop_error = true;
return;
}
std::cerr << "gst creating loop done" << std::endl;
pipeline = gst_parse_launch(argv[1], &error);
std::cerr << "gst pipeline parsed" << std::endl;
if (pipeline == NULL || error != NULL) {
std::cerr << "Failed to create the pipeline" << std::endl;
loop_error = true;
return;
}
gst_element_set_state(pipeline, GST_STATE_READY);
std::cerr << "gst pipeline created" << std::endl;
done = true;
std::cerr << "gst starting the pipeline loop" << std::endl;
g_main_loop_run(loop);
std::cerr << "gst pipeline loop exited" << std::endl;
}
int run(int argc, char* argv[])
{
std::thread playback_thread(playback, argc, argv);
std::cerr << "Waiting for the loop to be ready" << std::endl;
// wait until loop
while (!done) {
std::this_thread::sleep_for(std::chrono::microseconds(1000000));
}
// after sometime set the status to playing
gst_element_set_state(pipeline, GST_STATE_PLAYING);
// wait for a user command to seek
GstSeekFlags flags = GST_SEEK_FLAG_FLUSH;
gst_element_seek_simple(pipeline, GST_FORMAT_TIME, flags, GST_SECOND *
seek_pos);
}
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/RTSP-seek-issue-with-custom-client-tp4674360.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list