[MPlayer-users] DVD playback issue on older notebook with not so old Linux kernel

Erik Auerswald auerswal at unix-ag.uni-kl.de
Thu May 28 11:18:50 EEST 2020


Hello Reimar,


thanks for your feedback, I'll try to provide additional details.

On Wed, May 27, 2020 at 10:44:06PM +0200, Reimar Döffinger wrote:
> On Fri, May 15, 2020 at 11:05:34AM +0200, Erik Auerswald wrote:
> > I'd like to describe a DVD playback issue I encountered, and how to work
> > around the problem, just in case someone else runs into it.
> >
> > Since upgrading an older notebook (with HDD, no SSD) from Ubuntu 16.04 LTS
> > to Ubuntu 18.04 LTS, I could no longer play a complete DVD with MPlayer
> > without "hanging" playback.  The picture would freeze for a short,
> > but noticable time, at random moments.

Usually towards the end of the movie, unless lots of memory is filled
before starting DVD playback.  With heavy memory use before starting
DVD playback there are more playback issues.

> > This issue can be prevented by disabling swap:
> >
> >     sudo swapoff -a
> >
> > I would do that for a dedicated media player PC, but I'd rather avoid
> > this for a general purpose notebook system.  I disable swap just before
> > playing a DVD now.
> >
> > The problem lies in the use of swap at all, which impacts the system
> > heavily, instead of freeing pages from the page cache, which does not
> > impact the system at all for the streaming workload of DVD playback.
> 
> Hm, it overall sounds like a kernel issue that maybe should rather be
> reported as a kernel bug.

That does seem to be futile to me, since the Linux developers have their
special benchmark (customer workload?) that benefits from this behavior.

But I do concur with you in that I would call it a kernel issue as well.

> But I would be curious if using zram would "solve" this issue by
> giving the kernel a "lower impact" thing to swap into.

Interesting idea to delay the onset of the problem.

> That said I don't feel at all certain what exactly goes wrong there,
> i.e. what exactly does cause the pause:
> Is it not being able to read from the DVD fast enough? Why though?

But why would it be able to read fast enough after swap is disabled?
Additionally, the same problem occurs when playing from USB attached HDD
(disabling swap solves this as well).

I have not yet tried if it happens when playing from the IDE HDD; there
data to read would be on the same disk as the swap partition.

> Is it because the HDD is on the same bus as the DVD drive?
> Hardly if it's a USB DVD drive.

The HDD uses an IDE interface, the DVD is attached via USB.

> If it's not the DVD, -cache can of course not help.
> Is it that MPlayer's code/data itself gets swapped out?
> Which part then? Running "perf" with wall clock time measurement
> maybe can help?

I do not expect MPlayer's code to be swapped out, but rather some of
the many processes comprising a GNOME desktop.  But I did not yet even
try to find out what is swapped out.

I do not know how to use "perf" to examine this, perhaps you could
provide me with an additional hint?

> Or does the kernel maybe run into some huge lock that means while
> it's busy swapping MPlayer doesn't get to run?

Something like that is my suspicion.  Playback hangs, i.e., the picture is
frozen and sound stopped, for long enough to be seen clearly (in the order
of perhaps half a second mostly, I'd say).  After disabling swap I do
not experience anything like this, no noticable playback problem at all.

Perhaps the HDD is slower than the kernel developers expected, and/or
because the swap "partition" is a logical volume.

Or just because the general purpose kernel is just not optimized for
sufficiently low latency for movie playback from DVD (no realtime patches,
no realtime scheduling in use for DVD playback).  The "best effort"
approach used to suffice for DVD playback for me, and it does again
after disabling swap.

Thanks,
Erik
-- 
Memory, of course, is never true.
                        -- Ernest Hemingway


More information about the MPlayer-users mailing list