GNOME Bugzilla – Bug 769416
alsasrc, v4l2src: getting repeated timestamps when capturing from multiple sources (multiple pipelines in single command)
Last modified: 2016-08-02 10:48:45 UTC
Hello, I am an alsa and v4l2 drivers developer. I encountered the issue of getting repeated timestamps: 2 adjacent timestamps have the same value. The issue occurs when it is attempted to capture audio from 2 (or more) alsasrces in a single gst-launch command. The problem is generic and I think it is in the GStreamer "layer" because: - it happens for both audio sources (alsasrc) and for video captures (v4l2src) -> this excludes alsa middle layer. - I tested that it happens when capturing from various-branded hardware (see the example capturing from Intel sound device but it will occurs for other hardware as well). The problem breaks the audio & video sync for my customer and it is important for us to have it fixed. Please see the example below: 1) GET A LIST OF AUDIO CAPTURE DEVICES: **** List of CAPTURE Hardware Devices **** card 2: PCH [HDA Intel PCH], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: PCH [HDA Intel PCH], device 2: ALC662 rev1 Analog [ALC662 rev1 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 2) ATTEMPT TO CAPTURE FROM 2 DEVICES IN A SINGLE COMMAND: gst-launch-0.10 -v alsasrc device=hw:2,0 ! fakesink name=analog1 alsasrc device=hw:2,2 ! fakesink name=ANALOG2 | grep last-message | grep timestamp /GstPipeline:pipeline0/GstFakeSink:ANALOG2: last-message = "chain ******* (ANALOG2:sink) (4096 bytes, timestamp: 0:00:00.011609977, duration: 0:00:00.011609977, offset: 0, offset_end: 512, flags: 32 discont ) 0x154fe60" /GstPipeline:pipeline0/GstFakeSink:ANALOG2: last-message = "chain ******* (ANALOG2:sink) (4096 bytes, timestamp: 0:00:00.011609977, duration: 0:00:00.011609977, offset: 0, offset_end: 512, flags: 32 discont ) 0x154fe60" /GstPipeline:pipeline0/GstFakeSink:analog1: last-message = "chain ******* (analog1:sink) (4096 bytes, timestamp: 0:00:00.011609977, duration: 0:00:00.011609977, offset: 512, offset_end: 1024, flags: 0 ) 0x7fad18002dd0" /GstPipeline:pipeline0/GstFakeSink:analog1: last-message = "chain ******* (analog1:sink) (4096 bytes, timestamp: 0:00:00.023219954, duration: 0:00:00.011609977, offset: 1024, offset_end: 1536, flags: 0 ) 0x7fad18002e70" /GstPipeline:pipeline0/GstFakeSink:analog1: last-message = "chain ******* (analog1:sink) (4096 bytes, timestamp: 0:00:00.023219954, duration: 0:00:00.011609977, offset: 1024, offset_end: 1536, flags: 0 ) 0x7fad18002e70" /GstPipeline:pipeline0/GstFakeSink:analog1: last-message = "chain ******* (analog1:sink) (4096 bytes, timestamp: 0:00:00.034829931, duration: 0:00:00.011609978, offset: 1536, offset_end: 2048, flags: 0 ) ... We can clearly see that the first 2 timestamps are the same for ANALOG2 alsasrc. Why could that be? Would each pipeline in the above gst-launch command have a separate capture thread for audio capture? Can there be a problem to start them simultaneously? Note that the problem does not exist when the command is split into 2 commands: one for each alsasrc and attempted to run them at the same time from script: script1.sh: gst-launch-0.10 -v alsasrc device=hw:2,0 ! fakesink name=analog1 | grep last-message | grep timestamp script2.sh: gst-launch-0.10 -v alsasrc device=hw:2,2 ! fakesink name=ANALOG2 | grep last-message | grep timestamp script_main.sh: sh -x script1.sh & sh -x script2.sh & Thanks for your help with this, Przemek
Thanks for taking the time to report this. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 769413 ***