audio capture stalls, seeking advice

mattes effemm at mykmk.com
Mon Jun 23 13:08:03 PDT 2014


I setup a pipeline successfully to record and stream audio and video from a
live source. The pipeline looks like this:

  v4l2src do-timestamp=1 ! videocaps ! videorate ! \
     queue ! x264enc ! tee name=venc ! \
     queue ! rtph264pay pt=96 ! udpsink host=239.192.0.2 port=40002 \
     alsasrc ! audiocaps ! audioresample ! audioconvert \
     faac bitrate=128000 ! tee name=aenc ! \
     queue ! rtpmp4apay pt=97 ! udpsink host=239.192.0.4 port=40004 \
     venc. ! queue ! qtmux name=mux ! filesink location=avs.mp4    \
     aenc. ! queue ! mux.

Everything is working fine. I am able to pick up the AV stream via multicast
and playback the recorded file.

To pause the av recording at any give time I added 2 'valves' to the muxer
queue to control the frame flow. Like this:

     venc. ! queue ! valve ! qtmux name=mux ! filesink location=avs.mp4 \
     aenc. ! queue ! valve ! mux.

In case I want to pause the recording, I just tell the audio and video valve
element to drop its frames. Then the muxer queue stops recording successfully.
But unfortunately the audio streaming queue is stopping too, while video keeps
streaming.  

Doing some debugging I noticed that the audio capture actually stalls. Audio is
captured ~1-2 seconds after drop is activated, and then stops.
This only effects the audio. Video capturing keeps going all the time and
streams.

Once I unpause (drop=false) both valves, audio capture is re-engaged. Audio
starts streaming again and the muxer queue is resuming to record AV data to the
file.

For testing I created audio-only stream+record and video-only stream+record
pipelines, thinking it might be easier to find the cause of the problem.
But the audio-only/video-only pipeline work fine. No problem. Once I pause
(dropping the frames), recording comes to a halt, but the respective stream
queue keeps going.

   alsasrc ! audiocaps ! audioresample ! audioconvert ! \
    faac bitrate=128000 ! tee name=aenc ! \
    queue ! rtpmp4apay pt=97 ! udpsink host=239.192.0.4 port=40004  \
    aenc. ! queue ! valve ! qtmux ! filesink location=media.mp4

The problem only occurs with the combined AV pipeline.
I looked in detail at the GST_debug output hoping to learn more and find
an error or message shedding some light on the issue. But to no avail so far.

What makes the audio capture stall?
I was under the impression that valve just silently drops the frame
and should not have any impact on the source of the pipeline.

There is something going on, and I like to understand what it is.
Any advice or insights are deeply appreciated.

Mat




More information about the gstreamer-devel mailing list