Opened 12 years ago

Closed 12 years ago

#5043 closed patch (fixed)

Audio skips when using timestretch

Reported by: cizek@… Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: mythtv Version: 0.21-fixes
Severity: medium Keywords:
Cc: Ticket locked: no

Description

When I use multi-channel timestretch the audio will periodically skip back a few seconds. The picture plays fine and the audio eventually skips forward to match. I get a slew of "Audio buffer overflow, audio data lost", and "NVP: Video is xx frames ahead of audio..." messages when this happens.

AFAICT the value of waud in audiooutputbase.cpp is not wrapping around to 0 properly. This causes the above problem. The attached patch fixes it.

Attachments (2)

waud_overflow.patch.gz (536 bytes) - added by cizek@… 12 years ago.
mythtv_waud_wrap.1.patch (1021 bytes) - added by Mark Spieth 12 years ago.
my version of this patch. it is absolutely necessary.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 12 years ago by cizek@…

I've tried attaching my patch but Trac called it spam.

...then I tried to paste it with the same effect...

Here's the change:

-                    org_waud += amount;
+                    org_waud = (org_waud + amount) % AUDBUFSIZE;


... and...

-                        org_waud += nSamples * audio_bytes_per_sample;
+                        org_waud = (org_waud + nSamples * audio_bytes_per_sample) % AUDBUFSIZE;

Changed 12 years ago by cizek@…

Attachment: waud_overflow.patch.gz added

comment:2 Changed 12 years ago by cizek@…

gzip'd patch attached.

Thanks for the tip, Mark.

comment:3 Changed 12 years ago by Mark Spieth

I just double checked this and the increment is already guaranteed to be within range in both cases.

this should be closed as invalid. sorry bill.

comment:4 Changed 12 years ago by cizek@…

Not sure what's up then, Mark.

This is with 5.1 passthrough timestretch, which really rocks, BTW.

In my case, the value of org_waud (and therefor waud) was getting pegged at AUDBUFSIZE instead of wrapping around to 0. This is when the problem started. After the buffer drained, it would fix itself. When I made the above patch it started working ok again, and it's worked well for the past few weeks.

HTH, Bill

Changed 12 years ago by Mark Spieth

Attachment: mythtv_waud_wrap.1.patch added

my version of this patch. it is absolutely necessary.

comment:5 Changed 12 years ago by danielk

Resolution: fixed
Status: newclosed

(In [17252]) Fixes #5043. Refs #5313. Make sure we always modulo kAudioRingBufferSize when setting the audio ring buffer pointer.

Note: See TracTickets for help on using tickets.