audio recording and unwanted old frames

mattes effemm at mykmk.com
Thu Apr 24 18:01:21 PDT 2014


I do some audio recording which is paused on occasion
and after some time it is switched back to PLAYING to resume the recording.

I use this very simple pipeline:

   alsasrc -> audioconvert -> faac -> qtmux -> filesink

I setup a buffer probe to correct the buffer timestamps for the pause
duration. One thing I noticed is ,that every time I switch back from
PAUSE to PLAYing I get some 'old' audio frames.

example: 
Lets say I record for 30 seconds, then pause for 5 seconds
and resume recording. I will get 'old' audio frames with buffer timestamps
 30.x, 31.x, 32.x, 33.x, 34.x seconds. These are audio frames/samples
that have been captured during the pause duration.
All audio frames 35.x and later, are the ones when recording resumes.
Typically there are 100 samples per seconds. 
For the audio samples during the pause (30...34) I only see 3-4 per second.
all together maybe 15-20 max.

Further I noticed several messages/events with errors:
  alsarsc: warning: Dropped x samples, this most likely because 
           downstream can't keep up and is consuming samples too slow
  Can't record audio fast enough

So it seems that even though the alsasrc module is set to PAUSE state
(actually the entire pipeline is), it still receives/old unwanted audio
samples.

Is there a way to flush the audio capture side, to suppress these samples?
What is the recommended procedure to handle this case?

I could drop the buffer, but I am kinda curious why they show up
in the first place.

Mat




More information about the gstreamer-devel mailing list