Hi All,
When I played a video clip using gstfbsink plugin in Ti gstreamer package (dm355-gst-ti-0.2.3), I found some flickers occurred during displaying video data.
In the beginning, I suspected that gst_fbvideosink_fbimage_put function in gstfbsink.c had no control over framebuffer device using W AITFORVSYNC.
When I added this control in this function, I found that the video display was not fluency. Please refer to the following code:
static void gst_fbvideosink_fbimage_put(GstFbVideoSink * fbsink,
GstFbImageBuffer * fbimage)
{
Int dummy;
guint offset;
GstFbContext *fbcb;
g_return_if_fail(GST_IS_FBVIDEOSINK(fbsink));
g_return_if_fail(fbsink->fbcb != NULL);
GST_LOG("BEGIN...");
fbcb = fbsink->fbcb;
for (offset = 0; offset < fbcb->nbufs; offset++) {
if (fbcb->buffers[offset] == GST_BUFFER_DATA(fbimage))
break;
}
if (G_UNLIKELY(offset >= fbcb->nbufs)) {
GST_ERROR("Invalid framebuffer offset");
return;
}
GST_DEBUG("FB Offset: %d", offset);
// g_mutex_lock(fbsink->fb_lock);
//add waitfor vertical sync to fix flicker occurs during display by YHL
if (ioctl(fbcb->fd, FBIO_WAITFORVSYNC, &dummy) == -1) {
GST_ERROR("Failed FBIO_WAITFORVSYNC");
return GST_FLOW_ERROR;
}
fbcb->vinfo.yoffset = fbcb->vinfo.yres * offset;
if (ioctl(fbcb->fd, FBIOPAN_DISPLAY, &fbcb->vinfo) == -1) {
// g_mutex_unlock(fbsink->fb_lock);
GST_ERROR("FBIOPAN_DISPLAY failed");
return;
}
// g_mutex_unlock(fbsink->fb_lock);
GST_DEBUG("frame ts %llu", GST_BUFFER_TIMESTAMP(fbimage));
GST_LOG("END..");
}
Your help is much appreciated. Thanks very much.
Best Regards,
Jeff
Ailips Technology