I am trying to use the QCamera functionality of QT in order to scan barcodes. My device is a headless device that uses wayland. I'm using QT 5.9.1 and gstreamer 1.0 - v1.14. My device has the camerabin2 plugin on it and I can use gstreamer to record video/take pictures just fine alone. I was previously taking a picture with a separate gstreamer pipeline, gathering the file and feeding the image to QZXing to process but it was kinda slow. I wanted to see if i could get increased performance from using QCamera directly with QZXing but unfortunately I'm encountering some gstreamer errors.
Here is my code:
#include <QFile>
#include <QZXing.h>
#include <QCamera>
#include <QCameraInfo>
#include <QCameraImageCapture>
#include <QCameraViewfinder>
#include <QRegularExpressionMatch>
#include "wirelesscontrollermain.hpp"
#include "barcodereader.hpp"
#include "calibrationhandler.hpp"
#include "jsonhelper.hpp"
namespace
{
const int BARCODE_TIMEOUT_15S = 15000;
QZXing* mDecoder;
QCamera* mCamera;
QCameraImageCapture* mImageCapture;
QCameraViewfinder* mViewFinder;
}
BarcodeReader::BarcodeReader(WirelessControllerMain &parent)
: mParent(parent)
, mIsScanningActive(false)
, mTimeoutExpired(false)
, mScanningTimeout(this)
{
mScanningTimeout.setInterval(BARCODE_TIMEOUT_15S);
mScanningTimeout.setSingleShot(true);
QObject::connect(&mScanningTimeout, SIGNAL(timeout()), this, SLOT(onBarcodeFailureTimeout()));
}
BarcodeReader::~BarcodeReader()
{
delete mDecoder;
mDecoder = NULL;
delete mCamera;
mCamera = NULL;
delete mImageCapture;
mImageCapture = NULL;
}
void BarcodeReader::init()
{
if(QCameraInfo::availableCameras().count() > 0)
{
qWarning() << "we have cameras";
const QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
for (const QCameraInfo &cameraInfo : cameras)
{
qCritical() << cameraInfo.deviceName();
}
}
mCamera = new QCamera(QCameraInfo::defaultCamera());
mImageCapture = new QCameraImageCapture(mCamera);
QObject::connect(mImageCapture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(pictureReady(int,QImage)));
QObject::connect(mImageCapture, SIGNAL(imageAvailable(int,QVideoFrame)), this, SLOT(pictureReady(int,QVideoFrame)));
QObject::connect(mImageCapture, SIGNAL(error(int,QCameraImageCapture::Error,QString)), this, SLOT(onImgCapError(int, QCameraImageCapture::Error, QString)));
QObject::connect(mImageCapture, SIGNAL(readyForCaptureChanged(bool)), this, SLOT(onReadyForCapture(bool)));
QObject::connect(mCamera, SIGNAL(lockStatusChanged(QCamera::LockStatus,QCamera::LockChangeReason)), this, SLOT(onLockStatusChange(QCamera::LockStatus, QCamera::LockChangeReason)));
mCamera->setCaptureMode(QCamera::CaptureStillImage);
mCamera->start();
mViewFinder = new QCameraViewfinder();
mViewFinder->show();
mCamera->setViewfinder(mViewFinder);
}
void BarcodeReader::onReadyForCapture(bool isReadyForCapture)
{
if(isReadyForCapture)
{
qCritical() << "ready for capture";
}
else
{
qCritical() << "not ready for capture";
}
}
void BarcodeReader::onImgCapError(int value, QCameraImageCapture::Error error, QString string)
{
qWarning() << "integer: " <<value << "error:" << error << "string:" << string;
}
void BarcodeReader::onLockStatusChange(QCamera::LockStatus lockstatus, QCamera::LockChangeReason reason)
{
qWarning() << "lock status: " << lockstatus << "reason: " << reason;
}
/*!
* \brief BarcodeReader::startBarcodeScan
* called when the barcode scan button has been pressed
*/
void BarcodeReader::startBarcodeScan()
{
if(!mIsScanningActive)
{
qDebug() << "start barcode scan";
qWarning() <<"is capture mode supported?" << mCamera->isCaptureModeSupported(QCamera::CaptureStillImage);
if(mDecoder != NULL)
{
delete mDecoder;
mDecoder = NULL;
}
mDecoder = new QZXing();
QObject::connect(mDecoder, SIGNAL(error(QString)), this, SLOT(decodeError(QString)));
mDecoder->setDecoder(QZXing::DecoderFormat_EAN_8 | QZXing::DecoderFormat_EAN_13 | QZXing::DecoderFormat_QR_CODE | QZXing::DecoderFormat_DATA_MATRIX);
mIsScanningActive = true;
mCurrentBarcodeValue.clear();
mScanningTimeout.stop();
mScanningTimeout.start();
qCritical() << "camera state: " << mCamera->state();
qCritical() << "camera availability" << mCamera->availability();
if(mImageCapture->isReadyForCapture())
{
mImageCapture->capture();
}
else
{
qWarning() << "not ready for capture";
}
}
else
{
qWarning() << "barcode scanning already active";
}
}
void BarcodeReader::pictureReady(int id, const QVideoFrame &preview)
{
qWarning() << "PICTURE READY - videoframe";
}
void BarcodeReader::pictureReady(int id, const QImage &preview)
{
qWarning() << "PICTURE READY";
QString result = mDecoder->decodeImage(preview);
if(result.isEmpty())
{
if(mTimeoutExpired)
{
//if the timeout expired while we were waiting for a picture to be taken
//process the last image and then call it quits
endBarcodeScan();
}
else
{
qWarning() << "try another barcode pic";
mCamera->start();
//take a new picture and hope for the best
if(mImageCapture->isReadyForCapture())
{
mImageCapture->capture();
mCamera->unlock();
}
else
{
qWarning() << "not ready for capture";
}
}
}
}
/*!
* \brief BarcodeReader::decodeError
* \param err - gets called when QZXing encounters a scan error
*/
void BarcodeReader::decodeError(QString err)
{
qWarning() << "Decode Error: " << err;
}
/*!
* \brief BarcodeReader::onBarcodeFailureTimeout
* if weve been scanning for barcodes for X time and havent found anything,
* this function gets called by the timer
*/
void BarcodeReader::onBarcodeFailureTimeout()
{
qWarning() << "Could not find barcode: timeout expired";
mTimeoutExpired = true;
}
and here is the relevant debug output of the QT application
BarcodeReader::init - we have cameras
BarcodeReader::init - "/dev/video0"
BarcodeReader::init - "/dev/video1"
(qWirelessController:29981): GStreamer-CRITICAL **: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed
(qWirelessController:29981): GStreamer-CRITICAL **: gst_object_unref: assertion 'object != NULL' failed
- CameraBin error: "GStreamer error: negotiation problem."
- Unable to query the parameter info: "Invalid argument"
- Unable to query the parameter info: "Invalid argument"
- Unable to query the parameter info: "Invalid argument"
- Unable to query the parameter info: "Invalid argument"
- Unable to query the parameter info: "Invalid argument"
- Unable to query the parameter info: "Invalid argument"
BarcodeReader::startBarcodeScan - start barcode scan
BarcodeReader::startBarcodeScan - is capture mode supported? true
BarcodeReader::startBarcodeScan - camera state: QCamera::ActiveState
BarcodeReader::startBarcodeScan - camera availability 0
BarcodeReader::startBarcodeScan - not ready for capture
BarcodeReader::onBarcodeFailureTimeout - Could not find barcode: timeout expired
and here is a small portion of the gst_debug=4 output where the error occurs
:00:28.200701097 19677 0x1722a00 INFO viewfinderbin gstviewfinderbin.c:312:gst_viewfinder_bin_set_video_sink:<vf-bin> Setting video sink to <qgstvideorenderersink0>
0:00:28.218930847 19677 0x1722a00 INFO wrappercamerabinsrc gstwrappercamerabinsrc.c:995:set_capsfilter_caps:<camera_source> new_caps:ANY
0:00:28.233847264 19677 0x1722a00 INFO wrappercamerabinsrc gstwrappercamerabinsrc.c:884:gst_wrapper_camera_bin_src_set_zoom:<camera_source> setting zoom 1.000000
0:00:28.251089431 19677 0x1722a00 INFO wrappercamerabinsrc gstwrappercamerabinsrc.c:890:gst_wrapper_camera_bin_src_set_zoom:<camera_source> zoom set using digitalzoom
0:00:28.268826264 19677 0x1722a00 INFO GST_EVENT gstevent.c:1517:gst_event_new_reconfigure: creating reconfigure event
0:00:28.283702722 19677 0x1722a00 INFO GST_EVENT gstevent.c:1517:gst_event_new_reconfigure: creating reconfigure event
0:00:28.298587347 19677 0x1722a00 INFO wrappercamerabinsrc gstwrappercamerabinsrc.c:1003:set_capsfilter_caps:<camera_source> updated
0:00:28.313344514 19677 0x1722a00 INFO GST_STATES gstbin.c:2089:gst_bin_get_state_func:<preview-pipeline> getting state
0:00:28.328236139 19677 0x1722a00 INFO GST_ELEMENT_PADS gstpad.c:2134:gst_pad_unlink: unlinking preview-appsrc:src(0x18ced98) and preview-vscale:sink(0x18d2460)
0:00:28.346451306 19677 0x1722a00 INFO GST_ELEMENT_PADS gstpad.c:2188:gst_pad_unlink: unlinked preview-appsrc:src and preview-vscale:sink
0:00:28.362642306 19677 0x1722a00 INFO GST_ELEMENT_PADS gstutils.c:1774:gst_element_link_pads_full: trying to link element preview-appsrc:src to element preview-vscale:sink
0:00:28.381914181 19677 0x1722a00 INFO GST_ELEMENT_PADS gstelement.c:920:gst_element_get_static_pad: found pad preview-appsrc:src
0:00:28.397408972 19677 0x1722a00 INFO GST_ELEMENT_PADS gstelement.c:920:gst_element_get_static_pad: found pad preview-vscale:sink
0:00:28.412992139 19677 0x1722a00 INFO GST_PADS gstutils.c:1588:prepare_link_maybe_ghosting: preview-appsrc and preview-vscale in same bin, no need for ghost pads
0:00:28.432092806 19677 0x1722a00 INFO GST_PADS gstpad.c:2378:gst_pad_link_prepare: trying to link preview-appsrc:src and preview-vscale:sink
0:00:28.449303764 19677 0x1722a00 INFO GST_PADS gstpad.c:2586:gst_pad_link_full: linked preview-appsrc:src and preview-vscale:sink, successful
0:00:28.466614764 19677 0x1722a00 INFO GST_EVENT gstevent.c:1517:gst_event_new_reconfigure: creating reconfigure event
0:00:28.481535556 19677 0x1722a00 INFO GST_EVENT gstpad.c:5808:gst_pad_send_event_unchecked:<preview-appsrc:src> Received event on flushing pad. Discarding
0:00:28.499853681 19677 0x1722a00 INFO GST_STATES gstbin.c:2954:gst_bin_change_state_func:<camerabin> child 'imagebin-filesink' changed state to 2(READY) successfully
0:00:28.518643139 19677 0x1722a00 INFO GST_STATES gstbin.c:2954:gst_bin_change_state_func:<camerabin> child 'videobin-filesink' changed state to 2(READY) successfully
0:00:28.537619556 19677 0x1722a00 INFO GST_STATES gstbin.c:2506:gst_bin_element_set_state:<vf-bin> current NULL pending VOID_PENDING, desired next READY
0:00:28.555408306 19677 0x1722a00 INFO GST_ELEMENT_PADS gstpad.c:2134:gst_pad_unlink: unlinking vfbin->videoscale:src(0x196f780) and fakesink0:sink(0x18d2868)
0:00:28.573421056 19677 0x1722a00 INFO GST_ELEMENT_PADS gstpad.c:2188:gst_pad_unlink: unlinked vfbin->videoscale:src and fakesink0:sink
0:00:28.589460389 19677 0x1722a00 INFO GST_PARENTAGE gstbin.c:1801:gst_bin_remove_func:<vf-bin> removed child "fakesink0"
0:00:28.604571931 19677 0x1722a00 INFO GST_PARENTAGE gstbin.c:4468:gst_bin_get_by_name: [vf-bin]: looking up child element vfbin-videscale
(qWirelessController:19677): GStreamer-CRITICAL **: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed
0:00:28.632689764 19677 0x1722a00 WARN viewfinderbin gstviewfinderbin.c:237:gst_viewfinder_bin_create_elements:<vf-bin> error: linking videoscale and viewfindersink failed
0:00:28.651664431 19677 0x1722a00 INFO GST_ERROR_SYSTEM gstelement.c:2145:gst_element_message_full_with_details:<vf-bin> posting message: GStreamer error: negotiation problem.
0:00:28.671232931 19677 0x1722a00 INFO GST_ERROR_SYSTEM gstelement.c:2172:gst_element_message_full_with_details:<vf-bin> posted error message: GStreamer error: negotiation problem.
(qWirelessController:19677): GStreamer-CRITICAL **: gst_object_unref: assertion 'object != NULL' failed
0:00:28.701280723 19677 0x1722a00 INFO GST_STATES gstbin.c:2506:gst_bin_element_set_state:<qgstvideorenderersink0> current NULL pending VOID_PENDING, desired next READY
0:00:28.720489598 19677 0x1722a00 INFO GST_STATES gstelement.c:2676:gst_element_continue_state:<qgstvideorenderersink0> completed state change to READY
0:00:28.738063973 19677 0x1722a00 INFO GST_STATES gstelement.c:2579:_priv_gst_element_state_changed:<qgstvideorenderersink0> notifying about state-changed NULL to READY (VOID_PENDING pending)
Does anyone know what is causing this error? i can provide the full logs if someone finds it useful.
Yes.
0:00:28.218930847 19677 0x1722a00 INFO wrappercamerabinsrc gstwrappercamerabinsrc.c:995:set_capsfilter_caps:<camera_source> new_caps:ANY
0:00:28.233847264 19677 0x1722a00 INFO wrappercamerabinsrc gstwrappercamerabinsrc.c:884:gst_wrapper_camera_bin_src_set_zoom:<camera_source> setting zoom 1.000000
0:00:28.251089431 19677 0x1722a00 INFO wrappe
You need to remove the redundancies of the wrapper.
Related
I have a device running embedded linux that can show RTSP streams from a camera. The user can change the stream from a windowed stream to a full screen stream, and vice versa. If the stream is changed 32 times, the stream stops working. I have possibly narrowed down the problem to the rtspsrc itself.
My question is, how does one clear the memory for the gst "stuff" without re-starting the program?
If I use gst-launch-1.0 with the pipeline, it works for more than 32 re-starts because the program is being killed every time.
However, if I run my program and increase the rtspsrc to 31 (by switching between the two streams), and then run gst-launch-1.0 with a rtsp pipeline, the steam does not show up! It appears that until every program that is using gst is killed, the rtspsrc will not reset back to 0.
I enabled debugging the rtspsrc:
export GST_DEBUG="rtspsrc:6"
Lots of log messages are shown each time the stream is started. They print the rtspsrcX, which increases even though the previous stream is stopped:
First run log print:
**rtspsrc gstrtspsrc.c:8834:gst_rtspsrc_print_sdp_media:<rtspsrc0> RTSP response message**
Second run:
**rtspsrc gstrtspsrc.c:8855:gst_rtspsrc_print_sdp_media:<rtspsrc1> RTSP response message**
Continue stopping/starting the stream, and it increases up to 31, at which point the stream no longer shows up:
**rtspsrc gstrtspsrc.c:8855:gst_rtspsrc_print_sdp_media:<rtspsrc31> RTSP response message**
I'm not sure how to "reset" the stream each time the user stops it. It seems that gst can't release memory unless I kill the whole program (all programs using gst).
I have tried creating a new context each time the stream is re-started, but this doesn't help.
When I call gst_is_initialized each subsequent time, it returns true.
The main loop is stopped by calling the following from another thread:
g_main_loop_quit(loop_);
The video feeds are controlled with the following:
GMainLoop *loop_;
pipeline = "rtspsrc location=rtsp://192.168.0.243/0 latency=0 ! rtph264depay ! h264parse ! imxvpudec ! imxipuvideosink window-width=512 window-height=384 sync=false"
or
pipeline = "rtspsrc location=rtsp://192.168.0.243/0 latency=0 ! rtph264depay ! h264parse ! imxvpudec ! imxipuvideosink window-width=1024 window-height=768 sync=false"
void stream_video(std::string pipeline)
{
GMainContext* context;
GstElement *pipelineElement;
GstBus *bus = NULL;
guint bus_watch_id = 0;
GstState state;
try
{
if(!gst_is_initialized())
{
std::cout << "GST Is not initialized - initializing " << pipeline.c_str();
gst_init_check(nullptr,nullptr,nullptr);
}
context = g_main_contextnew(); // Creating a new context to see if the camera can be started more than 32 times, but the rtspsrc still increases when debugging
loop_ = g_main_loopnew (context, FALSE);
pipelineElement = gst_parse_launch(pipeline.c_str(), NULL);
bus = gst_pipeline_get_bus (GST_PIPELINE (pipelineElement));
bus_watch_id = gst_bus_add_watch (bus, bus_call, loop_);
gst_object_unref (bus);
bus = NULL;
gst_element_set_state(pipelineElement, GST_STATE_READY );
gst_element_set_state(pipelineElement, GST_STATE_PAUSED );
gst_element_set_state(pipelineElement, GST_STATE_PLAYING);
if (gst_element_get_state (pipelineElement, &state, NULL, 2*GST_SECOND) == GST_STATE_CHANGE_FAILURE)
{
std::cout << "gst: Failed to chage states State:" << state << " ID: " << stream_id_;
}
else
{
std::cout << "gst: Running..." << " ID: " << stream_id_ << " State:" << state << " Loop:" << loop_;
g_main_looprun (loop_); // blocks until loop_ exits (EOS, error, stop request)
}
gst_element_set_state(pipelineElement, GST_STATE_PAUSED);
gst_element_set_state(pipelineElement, GST_STATE_READY );
gst_element_set_state(pipelineElement, GST_STATE_NULL); // Can only switch between certian states, see https://gstreamer.freedesktop.org/documentation/additional/design/states.html?gi-language=c
g_source_remove (bus_watch_id);
std::cout << "gst: Removing pipelineElement " << pipelineElement;
gst_object_unref (GST_OBJECT (pipelineElement));
pipelineElement = NULL;
g_main_contextunref (context);
context = NULL;
g_main_loopunref (loop_);
loop_ = nullptr;
std::cout << "gst: Deleted pipeline" << " ID: " << stream_id_ << " State: " << state;
}
catch(const std::exception& e)
{
std::cout << "Error Caught: stream_video " << e.what();
}
return;
}
I am following the tictoc tutorial and I want to change the code of tictoc12 so that I'll get the index of the gate from which we received the message so that the message will not send out from the same gate. This is my handleMesssage() function:
void Txc12::handleMessage(cMessage *msg)
{
if (getIndex() == 3) {
// Message arrived.
EV << "Message " << msg << " arrived.\n";
delete msg;
}
else {
int arrivalGate = msg->getArrivalGate()->getIndex();
EV << "arrival gate: " << arrivalGate << "\n";
// We need to forward the message.
forwardMessage(msg);
}
}
and this is the error that i receive:
Simulation terminated with exit code: -1073741819
Working directory: D:/omnetpp-5.6.1/samples/tictoc
Command line: tictoc.exe -m -u Qtenv omnetpp.ini
Environment variables:
PATH=;D:\omnetpp-5.6.1\bin;D:\omnetpp-5.6.1\tools\win64\mingw64\bin;D:\omnetpp-5.6.1\tools\win64\usr\bin;;D:/omnetpp-5.6.1/ide/jre/bin/server;D:/omnetpp-5.6.1/ide/jre/bin;D:/omnetpp-5.6.1/ide/jre/lib/amd64;.;D:\omnetpp-5.6.1\bin;D:\omnetpp-5.6.1\tools\win64\mingw64\bin;D:\omnetpp-5.6.1\tools\win64\usr\local\bin;D:\omnetpp-5.6.1\tools\win64\usr\bin;D:\omnetpp-5.6.1\tools\win64\usr\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;D:\omnetpp-5.6.1\tools\win64\usr\bin\site_perl;D:\omnetpp-5.6.1\tools\win64\usr\bin\vendor_perl;D:\omnetpp-5.6.1\tools\win64\usr\bin\core_perl;D:\omnetpp-5.6.1;
OMNETPP_ROOT=D:/omnetpp-5.6.1/
OMNETPP_IMAGE_PATH=D:\omnetpp-5.6.1\images
Does anyone know what I'm doing wrong?
The value of exit code -1073741819 is equal to 0xC0000005 - an access violation. However, handleMessage() presented by you cannot be source of that error.
I strongly suggest using debugger to find the lines that cause that error. To do this:
Compile your project in debug mode.
In your omnetpp.ini set:
debug-on-errors = true
Start your simulation in debug (i.e. Run | Debug)
The execution of the simulation will stop just before the line that causes an exception.
Reference: TicToc Tutorial - 2.3 Debugging
After calling
dev.hardware_reset();
How do I know if the device is ready before starting the pipeline?
void rs2::context::set_devices_changed_callback (T callback) check doc
you can set a callback using set_devices_changed_callback to get notified when the device is connected or disconnected. Inside the callback you can use query_devices to know find the available devices. if the device is available you can start reading the frames.
My code to do that :
qDebug() << "[Stream] --- --- RealSense camera hardware reset...";
rs2::context ctx;
rs2::device dev = ctx.query_devices().front(); // Reset the first device
uint32_t nbDevices = ctx.query_devices().size();
qDebug() << "[Stream] --- --- RealSense camera hardware reset... nb devices :" << nbDevices;
dev.hardware_reset();
rs2::device_hub hub(ctx);
dev = hub.wait_for_device(); // waiting
qDebug() << "[Stream] --- --- RealSense camera hardware reset... OK";
i am trying to add a udp src dynamically to a running pipeline.
e.g
void addAudioSource(std::string const ip, int const port, int const payloadtype)
{
std::string description = "autoaudiosrc ! queue ! audioconvert ! audio/x-raw,rate=16000 ! avenc_g722 ! rtpg722pay";
audiosrc = Gst::Parse::create_bin(description, true);
pipeline->add(audiosrc);
{
auto srcpad = audiosrc->get_static_pad("src");
auto sinkpad = rtpbin->get_request_pad("send_rtp_sink_1");
srcpad->link(sinkpad);
}
rtpudpsinkAudio->set_property("host", ip);
rtpudpsinkAudio->set_property("port", port);
rtpudpsinkAudio->set_property("sync",true);
rtpudpsinkAudio->set_property("async",false);
pipeline->add(rtpudpsinkAudio);
{
auto srcpad = rtpbin->get_static_pad("send_rtp_src_1");
auto sinkpad = rtpudpsinkAudio->get_static_pad("sink");
srcpad->link(sinkpad);
}
pipeline->set_state(Gst::State::STATE_PLAYING);
}
--- and ---
void addAudioSink(std::string const ip, int const port, int const payloadtype)
{
char const caps[] = "application/x-rtp,media=(string)audio,clock-rate=(int)8000,payload=(int)%d";
char buffer[128] = {0};
sprintf(buffer,caps,payloadtype);
pipeline->add(rtpudpsrcAudio);
rtpudpsrcAudio->set_property("caps",
Gst::Caps::create_from_string(buffer));
{
auto srcpad = rtpudpsrcAudio->get_static_pad("src");
auto sinkpad = rtpbin->get_request_pad("recv_rtp_sink_1");
srcpad->link(sinkpad);
}
pipeline->set_state(Gst::State::STATE_PLAYING);
}
individually when i am not calling the other function the pipeline works fine.
if i try to call addAudioSink some time after addAudioSource , i always get this error when i debug through the application
0:00:18.190302584 [334m 6945 [00m 0x555556669450 [36mINFO [00m [00;01;34m GST_EVENT gstevent.c:814:gst_event_new_caps: [00m creating caps event application/x-rtp, media=(string)audio, clock-rate=(int)8000, payload=(int)9, ssrc=(uint)1388635048
0:00:18.190323116 [334m 6945 [00m 0x555556669450 [36mINFO [00m [00m basesrc gstbasesrc.c:2965:gst_base_src_loop:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m pausing after gst_pad_push() = not-linked
0:00:18.190333169 [334m 6945 [00m 0x555556669450 [33;01mWARN [00m [00m basesrc gstbasesrc.c:3055:gst_base_src_loop:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m error: Internal data stream error.
0:00:18.190337616 [334m 6945 [00m 0x555556669450 [33;01mWARN [00m [00m basesrc gstbasesrc.c:3055:gst_base_src_loop:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m error: streaming stopped, reason not-linked (-1)
0:00:18.190350252 [334m 6945 [00m 0x555556669450 [36mINFO [00m [00;01;31;47m GST_ERROR_SYSTEM gstelement.c:2145:gst_element_message_full_with_details:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m posting message: Internal data stream error.
0:00:18.190358717 [334m 6945 [00m 0x555556669450 [36mINFO [00m [00;01;31;47m GST_ERROR_SYSTEM gstelement.c:2172:gst_element_message_full_with_details:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m posted error message: Internal data stream error.
the other thing is that this pipeline works most of the time.
i am only hit by this error when i debug through the application and sometimes when on release build.
The only issue that i have been able to find out is.
sometimes it says rtpssrcdemux0:src_2345243 not linked, and then udpsrc fails with gst_pad_push() = not-linked.
there is this issue that i dont understand, that the pipeline works most of the time, it fails for 25 % of time.
please help
I get the following Error
GStreamer; Unable to start decoding process
in the Console when i try to start the QAudioDecoder.
The following code:
void Media::decode(Memo* memo){
decoder = new QAudioDecoder();
format.setSampleRate(48000);
format.setChannelCount(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setSampleType(QAudioFormat::UnSignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
decoder->setAudioFormat(format);
decoder->setSourceFilename(memo->getPathMedia());
connect(decoder, SIGNAL(bufferReady()), this, SLOT(readBuffer()));
decoder->start();
}
void Media::readBuffer(){
buffer = decoder->read();
}
I hope you can help me.
As #nayana suggested, I enabled GStreamer debug log with GST_DEBUG=3 and it showed that the source file name was uncorrectly set :
filesrc gstfilesrc.c:632:gst_file_src_uri_set_uri:<source> Invalid URI 'file:file:///home/rom1/Music/track01.mp3'
Just remove the file: prefix and it works.
// In my source file ...
QString source = qvariant_cast<QString>(audioPlayer->property("source"));
source.remove(0, 7);
qDebug() << "Loading media" << source;
decoder.setSourceFilename(source);
decoder.start();