OUT OF 2, ONE OF THE CAMERA STREAMING FREEZES SOMETIMES
-
I am using crosscontrol V1200 display , in which I use Qt5 to develop my app . one of it's screens stream the 2 ip cameras but sometimes , one of the cameras is getting slow. How to avoid it.here is the code:
#include "video1.h" #include "ui_video1.h" #include <QProcess> #include <qquickview.h> #include <QQmlContext> #include <QQuickItem> #include <QQuickWindow> #include <QQmlEngine> #include <QQmlComponent> #include <QQmlProperty> #include <QImage> #include <QQuickItem> #include <QQuickWindow> #include "gst_pipeline.h" #include "gstplayerjob.h" #include "gst_pipeline2.h" #include "gstplayerjob2.h" #include <gst/gst.h> #include <QFileInfo> #include <glib.h> #define STREAMING_PORT 50004 const QString URL = "rtsp://192.168.0.50:554/mainstream"; const QString URL2 = "rtsp://192.168.0.60:554/mainstream"; video1 * video1 :: video_instance = 0; video1 * video1:: video_current_instance() { if (!video1::video_instance){ if (!video1::video_instance){ video1::video_instance = new video1; }return video1::video_instance; } return video1::video_instance; } video1::video1(QWidget *parent) : QWidget(parent), ui(new Ui::video1) { ui->setupUi(this); ui->stackedWidget->setCurrentIndex(0); ui->pushButton_cam1_2->hide(); iTime_v = 0; video_timer=new QTimer(); connect(video_timer,SIGNAL(timeout()),this,SLOT(video_run_timer_slot())); video_timer->start(1000); } video1::~video1() { cleanupCameras(); delete ui; } void video1::video_run_timer_slot() { iTime_v = iTime_v + 1; if(iTime_v == 5) { setupCamera(URL, ui->quickWidget); } if(iTime_v == 10) { setupCamera(URL2, ui->quickWidget_2); video_timer->stop(); } } void video1::setupCamera(const QString &cameraUrl, QQuickWidget *quickWidget) { qDebug()<<"setting up camera with URL"<<cameraUrl; GstElement *pipeline = gst_pipeline_new("my-pipeline"); GstElement *sink = configureH264RtspVideoStreamPipeline(pipeline, cameraUrl); quickWidget->setSource(QUrl::fromLocalFile(":/camera.qml")); QQuickItem *rootObject = quickWidget->rootObject(); QQuickItem *videoItem = rootObject->findChild<QQuickItem *>("videoItem"); Q_ASSERT(videoItem); g_object_set(sink, "widget", videoItem, NULL); rootObject->window()->scheduleRenderJob(new GstPlayerJob(pipeline), QQuickWindow::BeforeSynchronizingStage); GstPlayerInfo playerInfo; playerInfo.pipeline = pipeline; playerInfo.sink = sink; playerInfo.quickWidget = quickWidget; cameraInfoList.append(playerInfo); gst_element_set_state(pipeline, GST_STATE_PLAYING); qDebug()<<"camera set up completed"; } void video1::cleanupCameras() { qDebug()<<"Cleaning up cameras."; for (const auto &cameraInfo : cameraInfoList) { gst_element_set_state(cameraInfo.pipeline, GST_STATE_NULL); gst_object_unref(cameraInfo.pipeline); gst_object_unref(cameraInfo.sink); } cameraInfoList.clear(); qDebug()<<"camera clean up completed"; } void video1::on_pushButton_cam1_released() { ui->quickWidget->setGeometry(60,90,1161,641); ui->quickWidget_2->hide(); ui->pushButton_cam1_2->show(); ui->pushButton_cam1->hide(); ui->pushButton_cam2->hide(); } void video1::on_pushButton_cam1_2_released() { ui->quickWidget->setGeometry(50,200,571,351); ui->quickWidget_2->setGeometry(661,200,571,351); ui->pushButton_cam1_2->hide(); ui->quickWidget_2->show(); ui->quickWidget->show(); ui->pushButton_cam1->show(); ui->pushButton_cam2->show(); } void video1::on_pushButton_cam2_released() { ui->quickWidget_2->setGeometry(60,90,1161,641); ui->quickWidget->hide(); ui->pushButton_cam1_2->show(); ui->pushButton_cam1->hide(); ui->pushButton_cam2->hide(); } void video1::startStreaming() { ui->quickWidget->setGeometry(50,200,571,351); ui->quickWidget_2->setGeometry(661,200,571,351); ui->pushButton_cam1_2->hide(); ui->quickWidget_2->show(); ui->quickWidget->show(); ui->pushButton_cam1->show(); ui->pushButton_cam2->show(); } void video1::stopStreaming() { }
[Edit aha_1980: Added code tags]
-
here is the debug file :
0:01:34.619762250 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m glwindow gstglwindow.c:340:gst_gl_window_new:[00m Could not create window. user specified (null), creating dummy window
0:01:34.633832000 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:2128:gst_v4l2_object_get_interlace_mode:[00m Driver bug detected - check driver with v4l2-compliance from http://git.linuxtv.org/v4l-utils.git0:01:34.634005375 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3165:gst_v4l2_object_get_nearest_size:v4l2h264dec:sink[00m Unsupported field type for H264@1x1: 0
0:01:34.634110500 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3175:gst_v4l2_object_get_nearest_size:v4l2h264dec:sink[00m Unable to try format: Inappropriate ioctl for device
0:01:34.634165375 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3047:gst_v4l2_object_probe_caps_for_format:v4l2h264dec:sink[00m Could not probe minimum capture size for pixelformat H264
0:01:34.634214500 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:2128:gst_v4l2_object_get_interlace_mode:[00m Driver bug detected - check driver with v4l2-compliance from http://git.linuxtv.org/v4l-utils.git0:01:34.634272250 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3165:gst_v4l2_object_get_nearest_size:v4l2h264dec:sink[00m Unsupported field type for H264@32768x32768: 0
0:01:34.634320375 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3175:gst_v4l2_object_get_nearest_size:v4l2h264dec:sink[00m Unable to try format: Inappropriate ioctl for device
0:01:34.634371125 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3053:gst_v4l2_object_probe_caps_for_format:v4l2h264dec:sink[00m Could not probe maximum capture size for pixelformat H264
0:01:34.654586500 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m glwindow gstglwindow.c:340:gst_gl_window_new:[00m Could not create window. user specified (null), creating dummy window
0:01:34.665603500 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:2128:gst_v4l2_object_get_interlace_mode:[00m Driver bug detected - check driver with v4l2-compliance from http://git.linuxtv.org/v4l-utils.git0:01:34.665797250 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3165:gst_v4l2_object_get_nearest_size:v4l2h264dec:sink[00m Unsupported field type for H264@1x1: 0
0:01:34.665912750 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3175:gst_v4l2_object_get_nearest_size:v4l2h264dec:sink[00m Unable to try format: Inappropriate ioctl for device
0:01:34.665967750 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3047:gst_v4l2_object_probe_caps_for_format:v4l2h264dec:sink[00m Could not probe minimum capture size for pixelformat H264
0:01:34.666014125 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:2128:gst_v4l2_object_get_interlace_mode:[00m Driver bug detected - check driver with v4l2-compliance from http://git.linuxtv.org/v4l-utils.git0:01:34.666071750 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3165:gst_v4l2_object_get_nearest_size:v4l2h264dec:sink[00m Unsupported field type for H264@32768x32768: 0
0:01:34.666123875 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3175:gst_v4l2_object_get_nearest_size:v4l2h264dec:sink[00m Unable to try format: Inappropriate ioctl for device
0:01:34.666177125 [32m 481[00m 0xaaab02bde400 [33;01mWARN [00m [00m v4l2 gstv4l2object.c:3053:gst_v4l2_object_probe_caps_for_format:v4l2h264dec:sink[00m Could not probe maximum capture size for pixelformat H264
0:01:34.737486625 [32m 481[00m 0xffff2c003360 [32;01mFIXME [00m [00;04m default gstutils.c:4025:gst_pad_create_stream_id_internal:fakesrc1:src[00m Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:01:34.738597750 [32m 481[00m 0xffff2c003800 [32;01mFIXME [00m [00;04m default gstutils.c:4025:gst_pad_create_stream_id_internal:fakesrc2:src[00m Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:01:34.742942000 [32m 481[00m 0xffff2c003860 [32;01mFIXME [00m [00;04m default gstutils.c:4025:gst_pad_create_stream_id_internal:fakesrc0:src[00m Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:01:34.742941875 [32m 481[00m 0xffff2c0038c0 [32;01mFIXME [00m [00;04m default gstutils.c:4025:gst_pad_create_stream_id_internal:fakesrc3:src[00m Creating random stream-id, consider implementing a deterministic way of creating a stream-id
Failed to link source pad to depayloader pad.
0:01:34.806878500 [32m 481[00m 0xffff3405ef00 [33;01mWARN [00m [00m rtpjitterbuffer rtpjitterbuffer.c:575:calculate_skew:[00m delta - skew: 0:00:01.150625611 too big, reset skew -
Hi and welcome to devnet,
I am no GStreamer expert but here you are creating twice the same pipeline with the same name. Does it have an influence ?
Then you are connecting twice to the same camera ? Is it expected ? Does the camera support multiple connections ?