Timestamping error/or comptuer too slow with gstreamer/gstbasesink in Qt
Dionis
dionis_sds at hotmail.com
Wed Sep 9 12:32:51 PDT 2015
Hi!
I am building a simple video player in Qt using gstreamer-1.0. When I run it
from Qt, or .exe in my pc, everything runs and works ok. But when I try it
from another pc, it plays for some seconds that it skips some
seconds/minutes and so on. I guess the problem is with sync, I have tried
setting d3dvidesink property: sync=false, but is the same. I have read many
similiar threads but none seems to help.
*A lot of buffers are being dropped. Additional debug info:
gstbasesink.c(2846): gst_base_sink_is_too_late (): There may be a
timestamping problem, or this computer is too slow.*
I have tried setting different properties, but none helped. I have seen the
following threads, but still the same problem:
Thread 1
<http://stackoverflow.com/questions/11397655/streaming-rtp-rtsp-sync-timestamp-problems>
Thread 2
<http://gstreamer-devel.966125.n4.nabble.com/There-may-be-a-timestamping-problem-or-this-computer-is-too-slow-td3807357.html>
Thread 3
<http://gstreamer-devel.966125.n4.nabble.com/Video-stream-timestamps-problem-td4657379.html>
On Thread 3 there is a suggestion setting "do-timestamp" property on appsrc
to TRUE, but I use uridecodebin as source that has not a "do-timestamp"
property.
My pipeline is as follows:
*uridecodebin ! audioconvert ! volume ! autoaudiosink ! videoconvert ! gamma
! d3dvideosink*
Thanks in Advance!
Here is some code, if you need more please comment.
// Create the elements
data.source = gst_element_factory_make ( "uridecodebin", "source"
);
data.audio_convert = gst_element_factory_make ( "audioconvert",
"audio_convert" );
data.volume = gst_element_factory_make ( "volume",
"volume");
data.audio_sink = gst_element_factory_make ( "autoaudiosink",
"audio_sink" );
data.video_convert = gst_element_factory_make ( "videoconvert",
"video_convert" );
data.filter = gst_element_factory_make ( "gamma",
"filter");
data.video_sink = gst_element_factory_make ( "d3dvideosink",
"video_sink" );
// Create the empty pipeline
data.pipeline = gst_pipeline_new ("test-pipeline");
if (!data.pipeline || !data.source || !data.audio_convert || !data.volume
|| !data.audio_sink
|| !data.video_convert || !data.filter ||
!data.video_sink ) {
g_printerr ("Not all elements could be created.\n");}
return ;
}
// Build the pipeline. Note that we are NOT linking the source at this
point. We will do it later.
gst_bin_add_many (GST_BIN (data.pipeline), data.source,
data.audio_convert , data.volume, data.audio_sink,
data.video_convert,
data.filter, data.video_sink, NULL);
if (!gst_element_link (data.audio_convert, data.volume)) {
g_printerr ("Elements AUDIO_CONVERT - VOLUME could not be linked.\n");
gst_object_unref (data.pipeline);
return ;
}
if (!gst_element_link (data.volume, data.audio_sink)) {
g_printerr ("Elements VOLUME - AUDIO_SINK could not be linked.\n");
gst_object_unref (data.pipeline);
return ;
}
if (!gst_element_link(data.video_convert, data.filter)) {
g_printerr("Elements VIDEO_CONVERT - FILTER could not be linked.\n");
gst_object_unref(data.pipeline);
return ;
}
if (!gst_element_link(data.filter, data.video_sink)) {
g_printerr("Elements FILTER - VIDEO_SINK could not be linked.\n");
gst_object_unref(data.pipeline);
return ;
}
// When I open Video:
// Set the URI to play
QString filePath = "file:///"+filename;
QByteArray ba = filePath.toLatin1();
const char *c_filePath = ba.data();
ret = gst_element_set_state (data.pipeline, GST_STATE_NULL);
gint64 max_lateness = 2000000; //2 milli sec
g_object_set (data.source, "uri", c_filePath, NULL);
// I have tried setting the following properties, but none helped
// g_object_set (data.source, "do-timestamp", true, NULL);
// g_object_set( data.video_sink, "sync", false, NULL);
// g_object_set( data.video_sink, "max-lateness", max_lateness, NULL);
qDebug() << &c_filePath;
// Link video_sink with playingWidget->winId()
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (data.video_sink),
xwinid);
// Connect to the pad-added signal
g_signal_connect (data.source, "pad-added", G_CALLBACK
(pad_added_handler), &data) ;
// Start playing
ret = gst_element_set_state (data.pipeline, GST_STATE_PLAYING);
if (ret == GST_STATE_CHANGE_FAILURE) {
gst_element_set_state (data.pipeline, GST_STATE_NULL);
gst_object_unref (data.pipeline);
// Exit application
QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));}
data.playing = TRUE;
data.rate = 1.0;
// Iterate - gets the position and length every 200 msec
g_print ("Running...\n");
emit setMsg( "Running...\n" );
currFileName = filename;
timer->start(500);
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Timestamping-error-or-comptuer-too-slow-with-gstreamer-gstbasesink-in-Qt-tp4673555.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list