I'm trying to resolve the issue with DACs connected over USB to the Rapberry Pi 4. I've tested three DACs so far: Alien DAC (based on PCM2702), Topping E30 (based on AK4493) and Khadas DAC (based on ES9038Q2M).
Sometimes when I use VLC for audio playback and when either skip to a different time in the track or switch to a new track the audio drops - no output. That very often happens with Topping and Khadas DACs. That never happens with Alien DAC. Here is the VLC log when that issue occurs:
The last messages repeated over and over again until the playback resumes to normal when I manually switch the audio track.
Probably anybody else faced the same issue and knows how to fix it?
Thanks!
Sometimes when I use VLC for audio playback and when either skip to a different time in the track or switch to a new track the audio drops - no output. That very often happens with Topping and Khadas DACs. That never happens with Alien DAC. Here is the VLC log when that issue occurs:
Code:
flac debug: emulated sync word
flac debug: emulated sync word
main debug: Buffering 0%
main debug: Buffering 2%
main debug: Buffering 4%
main debug: Buffering 6%
main debug: Buffering 9%
main debug: Buffering 11%
main debug: Buffering 13%
main debug: Buffering 15%
main debug: Buffering 18%
main debug: Buffering 20%
main debug: Buffering 22%
main debug: Buffering 25%
main debug: Buffering 27%
main debug: Buffering 29%
main debug: Buffering 31%
main debug: Buffering 34%
main debug: Buffering 36%
main debug: Buffering 38%
main debug: Buffering 41%
main debug: Buffering 43%
main debug: Buffering 45%
main debug: Buffering 47%
main debug: Buffering 50%
main debug: Buffering 52%
main debug: Buffering 54%
main debug: Buffering 57%
main debug: Buffering 59%
main debug: Buffering 61%
main debug: Buffering 63%
main debug: Buffering 66%
main debug: Buffering 68%
main debug: Buffering 70%
main debug: Buffering 73%
main debug: Buffering 75%
main debug: Buffering 77%
main debug: Buffering 79%
main debug: end of audio preroll
main debug: Buffering 82%
main debug: Buffering 84%
main debug: Buffering 86%
main debug: Buffering 89%
main debug: Buffering 91%
main debug: Buffering 93%
main debug: Buffering 95%
main debug: Buffering 98%
main debug: Stream buffering done (4086 ms in 29 ms)
main debug: Decoder wait done in 0 ms
main warning: playback too early (-96174): down-sampling
main warning: playback too late (110306): up-sampling
main warning: playback way too late (203080): flushing buffers
main debug: inserting 51591 zeroes
main warning: playback too late (72377): up-sampling
main warning: timing screwed (drift: 165441 us): stopping resampling
main warning: playback way too late (258300): flushing buffers
main debug: inserting 51972 zeroes
main warning: playback too late (80854): up-sampling
main warning: timing screwed (drift: 173984 us): stopping resampling
main warning: playback way too late (270229): flushing buffers
main debug: inserting 51454 zeroes
main warning: playback too late (72708): up-sampling
main warning: timing screwed (drift: 163608 us): stopping resampling
main warning: playback way too late (260490): flushing buffers
main debug: inserting 51393 zeroes
main warning: playback too late (70476): up-sampling
main warning: timing screwed (drift: 162990 us): stopping resampling
main warning: playback way too late (257217): flushing buffers
main debug: inserting 51775 zeroes
main warning: playback too late (78053): up-sampling
main warning: timing screwed (drift: 173214 us): stopping resampling
main warning: playback way too late (264664): flushing buffers
.....
Probably anybody else faced the same issue and knows how to fix it?
Thanks!
Yes it looks like VLC issue as MPV works fine. I'm just wondering why one DAC works and others don't. Doesn't VLC use the same code for all DACs?
I'm also trying to get the info on the VLC forum: Issues with DACs on Linux - The VideoLAN Forums
I'm also trying to get the info on the VLC forum: Issues with DACs on Linux - The VideoLAN Forums
Last edited:
PCM2702 supports only 44.1/48kHz. Does perhaps your VLC resample to higher samplerates for the other dacs?
Probably, though I use the following command-line properties when I start VLC:
--audio-resampler=disable --no-audio-time-stretch
Despite of that there are those up/down sampling message in the log.
--audio-resampler=disable --no-audio-time-stretch
Despite of that there are those up/down sampling message in the log.
The async/adaptive mode is hidden to alsa userspace app, the driver behaves identically.
rpi: Which RPi USB interface do you use, the VL805 USB3 controller, or the USB2 dwc2 IP core?
Does this show something interesting when the problem occurs?
for checking async mode control, general USB card status:
watch -n 0.5 'cat /proc/asound/SOUNDCARD/stream0'
for checking position of the playback pointer in the driver (should be increasing constantly):
watch -n 0.5 'cat /proc/asound/SOUNDCARD/pcm0p/sub0/sw_params'
rpi: Which RPi USB interface do you use, the VL805 USB3 controller, or the USB2 dwc2 IP core?
Does this show something interesting when the problem occurs?
for checking async mode control, general USB card status:
watch -n 0.5 'cat /proc/asound/SOUNDCARD/stream0'
for checking position of the playback pointer in the driver (should be increasing constantly):
watch -n 0.5 'cat /proc/asound/SOUNDCARD/pcm0p/sub0/sw_params'
The issue happens in both cases when I connect to USB2 and USB3.Here is the output from watch -n 0.5 'cat /proc/asound/card2/stream0':
It's the same when it works and when doesn't. When it doesn't work sometimes the status changes to 'Stop' and the whole section disappears. But then it comes back but still no audio. Sometimes Momentary freq = 44105 Hz changes to 44100 or 44106.
Here is the output from the watch -n 0.5 'cat /proc/asound/card2/pcm0p/sub0/sw_params':
It's the same when it works and doesn't.
Here is my .asoundrc just in case:
The file which I'm playing is 16 bit 44.1KHz FLAC.
Code:
Topping E30 at usb-0000:01:00.0-1.1, high speed : USB Audio
Playback:
Status: Running
Interface = 1
Altset = 1
Packet Size = 72
Momentary freq = 44105 Hz (0x5.8360)
Feedback Format = 16.16
Interface 1
Altset 1
Format: S32_LE
Channels: 2
Endpoint: 1 OUT (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
Data packet interval: 125 us
Bits: 32
Channel map: FL FR
Interface 1
Altset 2
Format: S32_LE
Channels: 2
Endpoint: 1 OUT (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
Data packet interval: 125 us
Bits: 24
Channel map: FL FR
Interface 1
Altset 3
Format: SPECIAL DSD_U32_BE
Channels: 2
Endpoint: 1 OUT (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
Data packet interval: 125 us
Bits: 32
DSD raw: DOP=0, bitrev=0
Channel map: FL FR
Here is the output from the watch -n 0.5 'cat /proc/asound/card2/pcm0p/sub0/sw_params':
Code:
tstamp_mode: NONE
period_step: 1
avail_min: 1764
start_threshold: 1
stop_threshold: 131072
silence_threshold: 0
silence_size: 0
boundary: 1073741824
Here is my .asoundrc just in case:
Code:
pcm.!default {
type plug
slave.pcm plugequal;
}
ctl.!default {
type hw CARD=E30,DEV=0
}
ctl.equal {
type equal;
}
pcm.plugequal {
type equal;
slave.pcm "plughw:CARD=E30,DEV=0"
}
pcm.equal {
type plug;
slave.pcm plugequal;
}
The file which I'm playing is 16 bit 44.1KHz FLAC.
Last edited:
Here is the data from the PCM2702 DAC which always works no matter what:
Code:
Burr-Brown Japan Burr-Brown Japan PCM2702 at usb-0000:01:00.0-1.1, full speed : USB Audio
Playback:
Status: Running
Interface = 1
Altset = 1
Packet Size = 192
Momentary freq = 44100 Hz (0x2c.199a)
Interface 1
Altset 1
Format: S16_LE
Channels: 2
Endpoint: 2 OUT (ADAPTIVE)
Rates: 32000, 44100, 48000
Bits: 16
Channel map: FL FR
Interface 1
Altset 2
Format: S16_LE
Channels: 1
Endpoint: 2 OUT (ADAPTIVE)
Rates: 32000, 44100, 48000
Bits: 16
Channel map: MONO
Code:
tstamp_mode: NONE
period_step: 1
avail_min: 1764
start_threshold: 1
stop_threshold: 132300
silence_threshold: 0
silence_size: 0
boundary: 1083801600
This doesn't look right to me.
I know the config file format is *very* flexible, but I'm not sure this is one of the optional formats??
Code:
ctl.!default {
type hw CARD=E30,DEV=0
}
I know the config file format is *very* flexible, but I'm not sure this is one of the optional formats??
Hi rpi,
I can't say for sure without testing it. This article shows a few of the formats:
A close look at ALSA
regards
I can't say for sure without testing it. This article shows a few of the formats:
A close look at ALSA
regards
There is one reply in the VLC forum:
It seems that the device driver fails to provide stable enough timestamps.
I'm just wondering is that device driver a part of the OS/ALSA or VLC?
Thanks!
It seems that the device driver fails to provide stable enough timestamps.
I'm just wondering is that device driver a part of the OS/ALSA or VLC?
Thanks!
If your vlc outputs to the default alsa device, your .asoundrc wraps the hw device with the equal plugin. That wrapper is presented to vlc as alsa device. What happens if you output directly to hw:device, without the equalizer plugin?
Which .asoundrc I have to try? This one doesn't work, not sure why:
Code:
pcm.!default {
type hw
card E30
dev 0
}
ctl.!default {
type hw
card E30
dev 0
}
Perhaps due to unsupported sample format tried by VLC. The plug plugin will not hurt anything, it's perfectly safe and bugfree.
I can't see anything wrong.
I am not sure if this is related to your problem as I am not familiar with VLC.
My Topping E30 DAC has an interesting feature. The card name is 'E30' and the control name is 'E30 '. Notice the trailing *space* at the end of the control name. A nasty little programming typo because is not readily noticeable or expected.
I assume that this may be/get fixed in later E30 firmware.
We had to modify piCorePlayer scripts to handle this trailing space.
I am not sure if this is related to your problem as I am not familiar with VLC.
My Topping E30 DAC has an interesting feature. The card name is 'E30' and the control name is 'E30 '. Notice the trailing *space* at the end of the control name. A nasty little programming typo because is not readily noticeable or expected.
I assume that this may be/get fixed in later E30 firmware.
We had to modify piCorePlayer scripts to handle this trailing space.
OK, this simple file works:
but the problem is still there.
Also I made more MPV testing and found that it doesn't drop audio but there is stuttering in the cases when VLC drops audio.
Code:
pcm.!default {
type hw
card E30
}
Also I made more MPV testing and found that it doesn't drop audio but there is stuttering in the cases when VLC drops audio.
I guess the non-working DACs officially run at USB2 (highspeed, 480M)? Do they run so in your setup (lsusb -t)? Sometimes a bad cable causes downgrading to fullspeed (12M).
Code:
$ lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
|__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
|__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
|__ Port 4: Dev 4, If 0, Class=Hub, Driver=hub/4p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 3, If 0, Class=Audio, Driver=snd-usb-audio, 480M
|__ Port 1: Dev 3, If 1, Class=Audio, Driver=snd-usb-audio, 480M
|__ Port 1: Dev 3, If 2, Class=Application Specific Interface, Driver=, 480M
|__ Port 2: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 3: Dev 6, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 4: Dev 7, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 4: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M
- Home
- Source & Line
- PC Based
- Issues with Pi 4, DACs and VLC