Opened 6 years ago

Last modified 13 months ago

#6541 new defect

WME: Theora A/V Sync drifts

Reported by: SF/tobiatesan Owned by: somaen
Priority: normal Component: Video
Keywords: Cc:
Game: Wintermute

Description

WINTERMUTE: We seem to have a problem with Theora video drifting out of sync with audio (= video is late).
Ubuntu 64 LTS here, Core 2 Duo, default backends compiled without any special flags or optimizations.

Evident in the long-ish intro video to Dirty Split and also in the test game on my github.

Happens with current master.
I also get WARNING: SDL mixer output buffer size: 1024 differs from desired: 2048!

I suspect it has something to do with frame dropping or lack thereof, but I might be wonderfully wrong.

Ticket imported from: bugs/6541.

Change History (6)

comment:1 by digitall, 6 years ago

Summary: WME:WME: Theora A/V Sync drifts

comment:2 by digitall, 6 years ago

Tobia: Please run ./scummvm -d 1 and report the SDL Video and Audio drivers being used. This could be a SDL audio driver issue on your machine.

Could you also indicate what sound card you are using?

comment:3 by SF/tobiatesan, 6 years ago

Here you are.
However, I really suspect that we are dealing with a /video/ issue here, in that the video does /not/ play in real time, while the audio does.
This leads inevitably to a drift.
I think we should drop frames or something.
I hope I can make sense of it over the weekend (I have little time, though).

$ ./scummvm -d 1
Debuglevel (from command line): 1
Using SDL Video Driver "x11"
Using SDL Audio Driver "pulse"
Output sample rate: 22050 Hz
Output buffer size: 1024 samples
WARNING: SDL mixer output buffer size: 1024 differs from desired: 2048!

$ lspci
00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory Controller Hub (rev 07)
00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)
00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)
00:03.0 Communication controller: Intel Corporation Mobile 4 Series Chipset MEI Controller (rev 07)
00:19.0 Ethernet controller: Intel Corporation 82567LM Gigabit Network Connection (rev 03)
00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 03)
00:1a.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 03)
00:1a.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 4 (rev 03)
00:1c.4 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 (rev 03)
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93)
00:1f.0 ISA bridge: Intel Corporation ICH9M-E LPC Interface Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 4 port SATA Controller [AHCI mode] (rev 03)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 03)
03:00.0 Network controller: Intel Corporation PRO/Wireless 5100 AGN [Shiloh] Network Connection
15:00.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev ba)
15:00.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 04)

comment:4 by SF/tobiatesan, 6 years ago

I may be awfully wrong here, but I think the culprit is:

bool VideoTheoraPlayer::update() {
_currentTime = _freezeGame ? _gameRef->getLiveTimer()->getTime() : _gameRef->getTimer()->getTime();

I think getTimer() is not actually real-time.
Will have to investigate further.

comment:5 by digitall, 6 years ago

Possible. I suggest that you also try export SDL_AUDIODRIVER=alsa as the lag could and the buffer size warning be partly due to pulseaudio.

comment:6 by digitall, 13 months ago

Component: Engine: WintermuteVideo
Note: See TracTickets for help on using tickets.