AnsweredAssumed Answered

Getting precise frame counts in alsa drivers on imx6q platform

Question asked by Frederic Jary on Jan 22, 2018

I am running a Yocto kernel (3.14.52 with PREEMPT_RT patch) on an imx6q board with 2 audio outputs :

- hdmi (via HDMI phy transmitter)

- jack ( via TLV320DAC32 chip)

The middleware running on top of the kernel (and the alsa lib) needs accurate delay (difference between hardware pointer and application pointer) to synchronize video rendering with audio stream.

Unfortunately, the hardware pointer is updated each time a DMA transfer has been completely done. This gives an unacceptable step effect.

The hardware can not provide a frame count of the audio rendering. Besides, there is not possibility to get a progress estimation of the DMA transfer. In these conditions, it is not amazing that  the residue granularity in the driver/alsa framework is set to DMA_RESIDUE_GRANULARITY_SEGMENT and not DMA_RESIDUE_GRANULARITY_BURST.

 

I have found a solution based on capturing timestamps to retrieve frame count, knowing the frame rate.

Did anyone experiment a more pretty solution?

Thank you.

Outcomes