Comments (5)
Hi,
Finally, I've got some time to dig around this issue and it seems that the problem is beyond my understanding....
The problem is (it seems it is) with the VLC audio synchronization code. For some strange reasons there is a build-in constraint, which determines audio-video maximal physical desynchronization. If the audio needs to be sent to the device in an advance (due to device internal delay, which is the case here), there is a maximal value for this advance time - and bluealsa exceeds this time approximately 30x. I've try to adjust these constrains, but the result was not satisfactory - there is no glitching (due to device start and stop), but the audio is not synced properly.
For the record, this is the change I've made (current master snapshot of VLC) to increase sync tolerance:
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -50,7 +50,7 @@
/** Maximum delay of actual audio playback time from coded PTS,
* above which upsampling will be performed */
-#define AOUT_MAX_PTS_DELAY (3 * CLOCK_FREQ / 50)
+#define AOUT_MAX_PTS_DELAY (100 * CLOCK_FREQ / 50)
/* Max acceptable resampling (in %) */
#define AOUT_MAX_RESAMPLING 10
Also, other related files:
I will not investigate this further. All reference implementations (imho) work correctly, e.g. aplay, mplayer (even firefox seems to work). If anyone with VLC code experience would like to contribute, I'd be very happy. Btw. I'm not saying, that it is not a bluealsa bug, I just don't know where to look for clues.
from bluez-alsa.
Do you have the same problem with vlc?
from bluez-alsa.
Yes, I was able to reproduce this bug. Bluealsa and VLC do not come along, unfortunately. There is a small chance, that when I figure out how to fix #15, this issue will be less severe. But I wouldn't bet on it.
In the meantime, you can use mpv/mplayer as a replacement for VLC. I'm using it as a reference video player.
from bluez-alsa.
Since commit e7a4c40 it is possible to customize (overwrite) PCM delay. Using this functionality, I've managed to force VLC to work without patching the source code. One can use something like this:
pcm.headset {
type plug
slave.pcm {
type bluealsa
device "88:C6:26:C2:76:35"
profile "a2dp"
delay -20000
}
hint {
show on
description "BT Headset"
}
}
The key part is delay -20000
. This value might vary between setups. If VLC is still stopping and starting PCM, increase or decrease this value, e.g.: -25000, -30000, -40000, -10000.
The result is, that audio is audible, but out of sync... by a second or two. So, use the keyboard shortcut J
in order to "fix" this out of sync audio (in my case it was -1000 ms). Done.
from bluez-alsa.
I think that this issue was resolved in #231
from bluez-alsa.
Related Issues (20)
- Buttons not working during callback recording HOT 2
- build/install: LC3Plus libraries?? HOT 2
- HSP HS profile: "arecord -d" duration is ignored HOT 1
- Routing audio to bluealsa from hw:0,1 HOT 31
- Test all deps with pkgconfig HOT 10
- arecord Unable to install hw params, record from bluetooth failed HOT 3
- Error compiling with aptx HOT 1
- Audio cut off in the beginning of the file HOT 3
- how can an SCO link be reestablished after it has been disconnected by the HF device? HOT 2
- How to pipe bluealsa PCM to fifo? HOT 18
- aplay Unable to install hw params HOT 1
- Can't get the A2DP profile to use LDAC codec HOT 11
- LDAC shows only 96KHz as sample rate | support for other sampling rates HOT 11
- Configuring asoundrc for default bluetooth ignored for Internet Browsers? HOT 2
- LE Audio support in bluez-alsa HOT 1
- Audio volume does not go to 100% on Raspberry Pi HOT 19
- Can't detect libsystemd-dev on debian trixie HOT 2
- test-alsa-ctl fails with bluealsa-mock: W: Couldn't get HCI device info: Address family not supported by protocol HOT 1
- test-alsa-midi fails due to permission errors HOT 1
- Build failure: undeclared variables HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bluez-alsa.