Hello,
I have a very precise question I need to ask a DM365 + audio codec savvy apps engineer.
Question (based on the issue description below):
What we need now is a way to recover from the underflow situation without rebooting. What I have seen online is that if it is a kernel module, you can unload and reload the kernel module. However, that still isn't acceptable as that will bring down the record application.
Question:
- Is there something that can be done to force a device reset when the playback device is opened?
The other possibility is get rid of this buffer underflow situation altogether but the customer and I have been unable to get to root cause…
Issues description:
The customer has a device that performs continuous capture for audio and video using gstreamer. In order to get the capture functionality working reliably, the ping-pong buffers needed to be enabled, but it was only enabled on the capture side. That has been working without issue. The product would playback some audio, but very infrequently for short durations, always using aplay. It was not using the ping-pong functionality for playback. The sound driver is compiled into the kernel, not as a module. Occasionally, but very rarely, would the audio playback stop working, but the issue was rare enough to be treated as a serious issue. When the audio playback stops working, the device will never play audio again until a reboot. The video and audio capture are encoded in hardware using the H.264 hardware device and the playback and capture audio are both at 8k sample rate to minimize CPU usage. The playback device in Linux is opened on demand to play audio, then closed again, which, as mentioned previously, wasn't very often.
The customer is now working on adding additional audio playback functionality to their product which would cause audio playback to occur more frequently. With the more frequent audio playback, the audio playback stopping working is more frequent, but still intermittent. It is now a critical issue. They are using the Linux kernel 2.6.32.17 with the ping-pong buffer patches, the batch mode patch, and all other recommended patches. The new audio playback support involves adding support to the customer’s existing product to play audio on the DM365 from RTP UDP packets as well as locally. This new functionality has been added as a new process on Linux that also uses gstreamer to listen for UDP packets as well as playing the occasional .wav file locally. The user space side works reliably, however the audio sometimes cuts out.
With the latest setup, the audio playback and capture are both using the ping-pong buffers. The audio device is still opened and closed for each audio playback, and the audio playback seems to stop working, intermittently. The customer was able to also narrow down the issue to a timing or incompatibility between concurrently using the McBSP for audio playback and the VPFE for video capture. The issue is only seen when the VPFE is in use. Interestingly, audio capture is unaffected and the video capture never fails. Performing a test with audio playback using the McBSP when the VPFE is not in use works appears to work without issue. The CPU usage is below 100% at all times. Tests with raising the CPU load cause audio glitches that are not related to this issue.
Thanks and best regards
electrons4me