I am working on audio capture using ALSA and DMAI on DM365 EVM, DVSDK 4.02.00.06.
Recording video and audio together (H.264 + AAC_LC into MP4) I noticed audio noise and the audio going out of sync with video, playing slightly too fast suggesting samples are being dropped at capture time or sample rates are off somewhere. The audio is about 1s fast per 150s recorded, the observed audio packet capture rate is about 42.74Hz over time. I calculated it should be about 43.07Hz (44.1kHz capture into 1024 sample AAC packets) which agrees with the playback rate difference I see.
Investigating, I made a test audio file to play into the EVM. it is a repeating sequence of 10 second tones with a short silence at the end of each 10 seconds. Viewing the EVM-recorded result in a wave editor I can see the same time compression I mentioned before, and occasional glitches in the shape of the sine wave, as if a few samples have been dropped. Note this was recorded on the EVM as AAC and recording video at the same time, so the box is busy.
I also tried recording from ALSA with "arecord". The results were odd, the first 20 seconds look good and the times are right. Then around 23 seconds in there is a glitch where the wave goes out of phase from one sample to the next. That 10-second tone ends up recorded as approximately 10.743s. I note that 44100Hz * 0.743s = 32766.3, suspiciously close to a round 32K. It looks like ALSA has injected a 32K sample buffer somehow.
In the next 10 second window two similar glitches appear, then the next 1 min 20s passes with no apparent glitches.
I am wondering if there is some kind of CPU load or interrupt latency issue stalling the audio capture and making it drop samples and do odd things. I am recording to SD card but have my filesystem mounted on NFS and am using telnet windows at the same time.
Any hints would be welcome as I continue to dig into this.