loading same gstreamer elements multiple times in a process

吃可爱长大的小学妹 提交于 2019-12-12 03:36:05

问题


This may be silly question. How gstreamer elements are loaded multiple times in a process?. When Gstreamer elements are created are they shared if already one created and present in memory? In my case, one process creates multiple thread, for each thread I am creating following gstreamer elements, linking and set pipeline to PLAYING state, filesrc->Q->filesink and this works. But when I add gstreamer element(newly written for processing gst buffers data) between Q->filesink all thread stops working, what might be the problem? How can I debug? Please provide inputs. Thanks in advance. -opensid


回答1:


The elements are within shared libraries and thus the code will be just once in memory. Each instance will occupy some memory for its own state though. When doing multithreaded stuff, you should call gst_init() just once from your main thread. As gstreamer already creates new threads for the data processing, it is saver to create all the gstreamer pipeline from one main thread. You can run several pipelines in parallel.




回答2:


I agree with ensonic's answer as it applies to data stored in klass. However it doesn't seem to apply to gbuffers. I am working my way through versions of a IEEE1278 audio transform based on basetransform. In one version there is a filter plug-in to allow UDP packets through based on set-able properties and a plug-in for two-way transform, IEEE1278 <-> mulaw depending on what the pads are set to.

For a simple test I tried a loop:

  • gst-launch-1.0 -v filesrc location=IsaacAsimov-Foundation1Of8_64kb.mp3 \
  • ! mpegaudioparse \
  • ! mpg123audiodec
  • ! 'audio/x-raw,rate=8000,channels=1' \
  • ! audioresample \
  • ! 'audio/x-raw,rate=8000,channels=1' \
  • ! mulawenc \
  • ! 'audio/x-mulaw,rate=8000,channels=1' \
  • ! dissignalaudio \
  • ! disfilter \
  • ! dissignalaudio \
  • ! 'audio/x-mulaw,rate=8000,channels=1' \
  • ! mulawdec \
  • ! 'audio/x-raw,rate=8000,channels=1' \
  • ! autoaudiosink

No matter what I did to the gbuffer data or metadata in dissignalausio_transform the output audio had a lot of strong clicking noise. gprints in mulawdec showed that none of my transform changes were arriving at mulawdec. I separated the loop into two launch pipelines using UDP loop-back and the noise went away. Somehow the gbuffer from the first instance of dissignalaudio was overriding the second instance.

Lesson learned:

There is a reason there are no examples of two-way transforms and all transforms have separate encode and decode plug-ins.



来源:https://stackoverflow.com/questions/14516511/loading-same-gstreamer-elements-multiple-times-in-a-process

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!