Gstreamer Pause/Resume pipeline issue - qt
I am using qt-gstreamer 1.2 with gstreamer 1.2.4 on nVidia TX1 running Ubuntu 14.04.
I am having a pipeline with camera preview + recording + Ethernet Streaming + Wifi Streaming and i want to make pipeline dynamic. ex i can add/remove recording/Streaming on running pipeline.
I pause pipeline to add/remove elements and then resume without using pads and its blocking capabilities. This works fine. But pipeline hangs after several add/remove of elements. and it hangs when i paused the pipeline.
I found that its Pause/Resume which hangs pipeline not Linking/Unlinking elements on pause.
If i add less elements in pipeline like only adding elements required for preview and recording then pipeline hangs after long time then with all elements.
All sink element sync and async are false.
m_pipeline = QGst::Pipeline::create();
m_source = QGst::ElementFactory::make("v4l2src", "v4l2src");
m_filter1 = QGst::ElementFactory::make("capsfilter", "capsfilter");
m_convert = QGst::ElementFactory::make("nvvidconv", "videoconvert");
m_filter2 = QGst::ElementFactory::make("capsfilter", "capsfilter1");
m_filter3 = QGst::ElementFactory::make("capsfilter", "capsfilter2");
m_tee = QGst::ElementFactory::make("tee", "tee");
m_tee1 = QGst::ElementFactory::make("tee", "tee1");
m_enc = QGst::ElementFactory::make("omxh264enc", "omxh264enc");
m_enc1 = QGst::ElementFactory::make("omxh264enc", "omxh264enc1");
m_parse = QGst::ElementFactory::make("h264parse", "h264parse");
m_parse1 = QGst::ElementFactory::make("h264parse", "h264parse1");
m_parse2 = QGst::ElementFactory::make("h264parse", "h264parse2");
m_mux = QGst::ElementFactory::make("qtmux", "qtmux");
m_filesink = QGst::ElementFactory::make("filesink", "filesink");
m_queue1 = QGst::ElementFactory::make("queue", "queue1");
m_queue2 = QGst::ElementFactory::make("queue", "queue2");
m_queue3 = QGst::ElementFactory::make("queue", "queue3");
m_queue4 = QGst::ElementFactory::make("queue", "queue4");
m_queue5 = QGst::ElementFactory::make("queue", "queue5");
m_queue6 = QGst::ElementFactory::make("queue", "queue6");
m_queue7 = QGst::ElementFactory::make("queue", "queue7");
m_queue8 = QGst::ElementFactory::make("queue", "queue8");
m_fakesink = QGst::ElementFactory::make("fakesink", "fakesink");
m_rtppay1 = QGst::ElementFactory::make("rtph264pay", "rtph264pay");
m_rtppay2 = QGst::ElementFactory::make("rtph264pay", "rtph264pay1");
m_udpsink = QGst::ElementFactory::make("udpsink", "udpsink");
m_udpsink1 = QGst::ElementFactory::make("udpsink", "udpsink1");
m_videoSink = QGst::ElementFactory::make("nvoverlaysink", "sink");
m_tee2 = QGst::ElementFactory::make("tee", "tee3");
m_fakesink1 = QGst::ElementFactory::make("fakesink", "fakesink1");
m_mux1 = QGst::ElementFactory::make("qtmux", "qtmux1");
m_filesink1 = QGst::ElementFactory::make("filesink", "filesink1");
m_filter1->setProperty("caps", QGst::Caps::fromString("video/x-raw, width=1920, height=1080, format=UYVY, framerate=60/1"));
m_filter2->setProperty("caps", QGst::Caps::fromString("video/x-raw(memory:NVMM), width=1920, height=1080, format=I420, framerate=60/1"));
m_filter3->setProperty("caps", QGst::Caps::fromString("video/x-h264, stream-format=(string)byte-stream"));
m_videoSink->setProperty("sync", false);
m_videoSink->setProperty("async", false);
m_pipeline->setProperty("video-sink", m_videoSink);
m_filesink->setProperty("sync", false);
m_filesink->setProperty("async", false);
m_enc->setProperty("bitrate", 19000000);
m_enc->setProperty("low-latency", 1);
m_enc->setProperty("control-rate", 2);
m_filesink->setProperty("location", "/home/ubuntu/video.mp4");
m_rtppay1->setProperty("mtu", 1400);
m_rtppay2->setProperty("mtu", 1400);
m_filesink1->setProperty("sync", false);
m_filesink1->setProperty("async", false);
m_filesink1->setProperty("location", "/home/ubuntu/video1.mp4");
m_udpsink->setProperty("port", 5000);
m_udpsink->setProperty("sync", false);
m_udpsink->setProperty("async", false);
m_udpsink->setProperty("host", "127.0.0.1");
m_udpsink1->setProperty("port", 8554);
m_udpsink1->setProperty("sync", false);
m_udpsink1->setProperty("async", false);
m_udpsink1->setProperty("host", "172.10.10.135");
m_pipeline->add(m_source, m_filter1, m_tee2, m_queue6, m_fakesink1);
m_pipeline->add(m_queue7, m_convert, m_filter2, m_tee, m_queue1, m_videoSink);
m_pipeline->add(m_queue2, m_enc, m_filter3, m_tee1, m_queue8, m_fakesink);
m_pipeline->add(m_queue3, m_parse, m_mux, m_filesink);
m_pipeline->add(m_queue4, m_parse1, m_rtppay1, m_udpsink);
m_pipeline->add(m_queue5, m_parse2, m_rtppay2, m_udpsink1);
m_pipeline->linkMany(m_source, m_filter1, m_tee2, m_queue6, m_fakesink1);
m_pipeline->linkMany(m_tee2, m_queue7, m_convert, m_filter2, m_tee, m_queue1, m_videoSink);
m_pipeline->linkMany(m_tee, m_queue2, m_enc, m_filter3, m_tee1, m_queue8, m_fakesink);
m_pipeline->linkMany(m_tee1, m_queue3, m_parse, m_mux, m_filesink);
m_pipeline->linkMany(m_tee1, m_queue4, m_parse1, m_rtppay1, m_udpsink);
m_pipeline->linkMany(m_tee1, m_queue5, m_parse2, m_rtppay2, m_udpsink1);
for testing i am pause and play pipeline every 1 sec.
m_pipeline->setState(QGst::StatePaused);
QThread::msleep(10);
m_pipeline->setState(QGst::StatePlaying);
The pipeline hangs after several Pause/Resume.
If i remove last 2 lines of linkmany and add the i can pause/resume more times than with all elements added.
So whats the problem here?
How can i pause / play pipeline efficiently?
Related
Getting the output of a script in Matlab called from R
I am trying to call a very simple script in Matlab from RStudio. However, whenever I run the following code, without getting any error, it will return 0 to me. Would you please let me know how I can call Matlab scripts in R and get their outputs? run_matlab_script("C:/Users/XXX/Desktop/Sum.m", verbose = TRUE, desktop = FALSE, splash = FALSE, display = TRUE, wait = TRUE, single_thread = FALSE) Note that to use the above function, I am using "matlabr" package in r. Moreover, my simple script in Matlab includes the below code: b=1+2 Thanks in advance!
matlab::run_matlab_script uses system to call matlab. As of today, that function (current commit is c01d310) looks like: run_matlab_script = function( fname, verbose = TRUE, desktop = FALSE, splash = FALSE, display = FALSE, wait = TRUE, single_thread = FALSE, ...){ stopifnot(file.exists(fname)) matcmd = get_matlab( desktop = desktop, splash = splash, display = display, wait = wait, single_thread = single_thread) cmd = paste0(' "', "try, run('", fname, "'); ", "catch err, disp(err.message); ", "exit(1); end; exit(0);", '"') cmd = paste0(matcmd, cmd) if (verbose) { message("Command run is:") message(cmd) } x <- system(cmd, wait = wait, ...) return(x) } Noteworthy (to me) is that run_matlab_script includes ... in its formals, and passes that unchanged to system. In fact, its help documentation specifically says that is what it does: #' #param ... Options passed to \code{\link{system}} Because of this, we can try to capture its output by looking at system. From ?system, intern: a logical (not 'NA') which indicates whether to capture the output of the command as an R character vector. which suggests that if you change your call to ret <- run_matlab_script("C:/Users/XXX/Desktop/Sum.m", verbose = TRUE, desktop = FALSE, splash = FALSE, display = TRUE, wait = TRUE, single_thread = FALSE, intern = TRUE) you will get its output in out.
Alfresco - Is it possible to get bpm:comment property from workflow task using Java API?
I tried getting properties from WorkflowTask Object but not getting comment property. Currently referring to this API documentation: https://dev.alfresco.com/resource/AlfrescoOne/5.1/PublicAPI/org/alfresco/service/cmr/workflow/WorkflowTask.html List<WorkflowTask> allTasks; allTasks = workflowService.queryTasks(taskQuery,true); for(int i=0; i<allTasks.size(); i++) { HashMap<String, Object> taskInfo = new HashMap<String, Object>(); task = allTasks.get(i); Map<QName,Serializable> taskProperties = task.getProperties(); } I ran debugging mode and checked taskProperties contents.
It seems that you are trying to retrieve the comment of active task, tasks which are not completed yet.For those task you user needs to write comment and save it. Once it is saved you will be able to see it. If its not the active tasks which you are getting then,comment should not be null. Below is output when i tried same code for retrieving the active task and printed properties. {http://www.alfresco.org/model/content/1.0}created = Fri Mar 16 12:56:26 IST 2018 {http://www.alfresco.org/model/bpm/1.0}percentComplete = 0 {http://www.alfresco.org/model/bpm/1.0}pooledActors = [] {http://www.alfresco.org/model/content/1.0}name = Task {http://www.alfresco.org/model/bpm/1.0}packageActionGroup = {http://www.alfresco.org/model/bpm/1.0}reassignable = true {http://www.alfresco.org/model/bpm/1.0}outcomePropertyName = {http://www.alfresco.org/model/workflow/1.0}reviewOutcome {http://www.alfresco.org/model/content/1.0}owner = test {http://www.alfresco.org/model/workflow/1.0}reviewOutcome = Reject {http://www.alfresco.org/model/bpm/1.0}taskId = 1889 {http://www.alfresco.org/model/bpm/1.0}packageItemActionGroup = edit_package_item_actions {http://www.alfresco.org/model/bpm/1.0}dueDate = null {http://www.alfresco.org/model/bpm/1.0}completionDate = null {http://www.alfresco.org/model/bpm/1.0}description = asd {http://www.alfresco.org/model/bpm/1.0}priority = 2 {http://www.alfresco.org/model/bpm/1.0}status = Not Yet Started {http://www.alfresco.org/model/bpm/1.0}package = workspace://SpacesStore/ee203aff-9842-4d7b-b7e9-0f40b0b8a3b3 {http://www.alfresco.org/model/bpm/1.0}startDate = Fri Mar 16 12:56:26 IST 2018 {http://www.alfresco.org/model/bpm/1.0}comment = sdadasdasdasd {http://www.alfresco.org/model/bpm/1.0}hiddenTransitions =
Best way to import bulk data into ArangoDB
I'm currently working on an ArangoDB POC. I find that the time taken for document creation is very high in ArangoDB with PyArango. It takes about 5 minutes to insert 300 documents. I've pasted the rough code below, please let me know if there are better ways to speed this up : with open('abc.csv') as fp: for line in fp: dataList = line.split(",") aaa = dbObj['aaa'].createDocument() bbb = dbObj['bbb'].createDocument() ccc = dbObj['ccc'].createEdge() bbb['bbb'] = dataList[1] aaa['aaa'] = dataList[0] aaa._key = dataList[0] aaa.save() bbb.save() ccc.links(aaa,bbb) ccc['related_to'] = "gfdgf" ccc['weight'] = 0 ccc.save() The different collections are created by the below code : dbObj.createCollection(className='aaa', waitForSync=False)
for your problem with the batch mode in the arango java driver. if you know the key attributes of the vertices you can build the document handle by "collectionName" + "/" + "documentKey". Example: arangoDriver.startBatchMode(); for(String line : lines) { String[] data = line.split(","); BaseDocument device = new BaseDocument(); BaseDocument phyAddress = new BaseDocument(); BaseDocument conn = new BaseDocument(); String keyDevice = data[0]; String handleDevice = "DeviceId/" + keyDevice; device.setDocumentKey(keyDevice); device.addAttribute("device_id",data[0]); String keyPhyAddress = data[1]; String handlePhyAddress = "PhysicalLocation/" + keyPhyAddress; phyAddress.setDocumentKey(keyPhyAddress); phyAddress.addAttribute("address",data[1]); final DocumentEntity<BaseDocument> from = arangoDriver.graphCreateVertex("testGraph", "DeviceId", device, null); final DocumentEntity<BaseDocument> to = arangoDriver.graphCreateVertex("testGraph", "PhysicalLocation", phyAddress, null); arangoDriver.graphCreateEdge("testGraph", "DeviceId_PhysicalLocation", null, handleDevice, handlePhyAddress, null, null); } arangoDriver.executeBatch();
I would build all of the data to be inserted into a json formatted string and use createDocumentRaw to create them all at once with one save.
web2py SQLFORM.grid url
When I try to put form = SQLFORM.grid(db.mytable) in my controller the request changes to my/web/site/view?_signature=520af19b1095db04dda2f1b6cbea3a03c3551e13 which causes my if statement in controller to collapse. Can smbd please explain why this happens? If I put user_signature=False then on view load the grid is shown (though the looks is awful, and I still need to find out how to change the view of my table), but on search,edit, etc. click, the same thing happens again. The url is changed and I get an error Any suggestions? thank you EDIT This is my edit function #auth.requires_login() def edit(): #Load workers workers = db(db.worker.w_organisation == 10).select(db.worker.w_id_w, db.worker.w_organisation, db.worker.w_first_name, db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email,db.worker.w_status,db.worker.w_note).as_list() #Define the query object. Here we are pulling all contacts having date of birth less than 18 Nov 1990 query = ((db.worker.w_organisation == 10) & (db.worker.w_status==db.status.s_id_s)) #Define the fields to show on grid. Note: (you need to specify id field in fields section in 1.99.2 fields = (db.worker.w_first_name, db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email,db.status.s_code,db.worker.w_note) #Define headers as tuples/dictionaries headers = { 'worker.w_first_name' : 'Ime', 'worker.w_last_name' : 'Priimek', 'worker.w_nick_name' : 'Vzdevek', 'worker.w_email' : 'E-posta', 'status.s_code': 'Status', 'worker.w_note' : 'Komentar' } #Let's specify a default sort order on date_of_birth column in grid default_sort_order=[db.worker.w_last_name] #Creating the grid object form = SQLFORM.grid(query=query, fields=fields, headers=headers,searchable=True, orderby=default_sort_order,create=True, \ deletable=True, editable=True, maxtextlength=64, paginate=25,user_signature=False ) form = SQLFORM.grid(db.worker,user_signature=False) workersDb = db((db.worker.w_organisation == 10) & (db.worker.w_status==db.status.s_id_s)).select(db.worker.w_id_w, \ db.worker.w_organisation, db.worker.w_first_name, \ db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email,\ db.status.s_code,db.worker.w_note).as_list() workersList = [] for rec in workersDb: status = rec['status']['s_code'] workers = rec['worker'] if not rec["worker"]["w_first_name"]: polno_ime = rec["worker"]["w_last_name"] elif not rec["worker"]["w_last_name"]: polno_ime = rec["worker"]["w_first_name"] else: polno_ime = rec["worker"]["w_first_name"] + " " + rec["worker"]["w_last_name"] rec["worker"]['w_full_name'] = polno_ime rec["worker"]["w_status"] = status data = rec["worker"] #print rec #print data workersList.append(rec["worker"]) # If type of arg is int, we know that user wants to edit a script with an id of the argument if(request.args[0].isdigit()): script = db(getDbScript(request.args[0])).select(db.script.sc_lls, db.script.sc_name, db.script.id, db.script.sc_menu_data).first() formData = str(script["sc_menu_data"]) #form = SQLFORM.grid(db.auth_user) #print formData # If we dont get any results that means that user is not giving proper request and we show him error #print script #Parsing script to be inserted into view if not script: return error(0) return dict(newScript = False, script = script, formData = formData, workers = workersList, form = form) # If the argument is new we prepare page for new script elif request.args[0] == 'new': scripts = db((auth.user.organization == db.script.sc_organization)).select(db.script.sc_name, db.script.id, workers = workersList, form = form) return dict(newScript = True, scripts = scripts, workers = workersList, form = form) # Else error else: return error(0) also not to mention the sqlgrid looks awful, here is link to the picture https://plus.google.com/103827646559093653557/posts/Bci4PCG4BQQ
MsRdpClient - open with querystring parameters
I'm currently trying to open an MsRdpClient connection in a web browser by opening a new tab and passing it dynamic server names. However, the following code doesn't seem to work and I can't dynimically populate any of the required values, namely servername and available screen width and height. resWidth = request.querystring("width") resHeight = request.querystring("height") MsRdpClient.DesktopWidth = resWidth MsRdpClient.DesktopHeight = resHeight MsRdpClient.Width = resWidth MsRdpClient.Height = resHeight MsRdpClient.server = request.querystring("fqdn") MsRdpClient.username = "username" MsRdpClient.AdvancedSettings.ClearTextPassword = "password" MsRdpClient.AdvancedSettings2.RDPPort = "3389" MsRdpClient.Connect I'm not really sure where to go from here. I see it's been asked on a few boards but no one has seem to come up with an answer. Any help would be greatly appreciated.
Below is the script I ended up using. putting the required variables in via scriptlets is what did the trick. i.e. the "<%=fqdn%>" resWidth = (screen.AvailWidth - 45) resHeight = (screen.AvailHeight - 150) MsRdpClient.DesktopWidth = resWidth MsRdpClient.DesktopHeight = resHeight MsRdpClient.Width = resWidth MsRdpClient.Height = resHeight MsRdpClient.server = "<%=fqdn%>" MsRdpClient.AdvancedSettings2.RDPPort = "3389" MsRdpClient.Connect sub MsRdpClient_OnDisconnected(disconnectCode) history.go(-1) end sub