GNOME Bugzilla – Bug 345720
Bad performance playing files off CD
Last modified: 2006-07-04 09:02:52 UTC
I'm seeing really bad playback of an AVI file directly off CD. I think it is caused by the access pattern that results. Buffers are delivered to avidemux, which does subbuffering and puts things in queues. A while later, the audio and video decoder start accessing those pages. This means that now avidemux and the audio/video decoders are trying to access pages in quite different locations. Unfortunately, filesrc specified (using madvise) that we'd be doing sequential access, so the kernel is being forced to page-in things it already threw away. Turning off MADV_SEQUENTIAL and touching each page to read it in immediately improves things greatly. Attaching a patch.
Created attachment 67878 [details] [review] Don't MADV_SEQUENTIAL. Touch each page when reading.
filesrc has a "touch" property that suposedly pages in each page. What about a property to turn off the sequential hint?
Oh, so it does. I think the sequential hint should be off by default, possibly with a property to turn it _on_. We only want to turn it on for specific access patterns though, otherwise it's going to cause pathological access patterns, since the kernel will flush pages as soon as downstream touches a later one. There's no way to know which behaviour downstream is going to have. simple mp3 files are going to be sequentially access, but every muxed format probably won't.
Also, touch should possibly be on by default.
Created attachment 67888 [details] [review] new patch. Adds 'sequential' property to filesrc, disabled by default. Turns on TOUCH by default, but might leave that part out.
* plugins/elements/gstfilesrc.c: (gst_file_src_class_init), (gst_file_src_init), (gst_file_src_set_property), (gst_file_src_get_property), (gst_file_src_map_region): * plugins/elements/gstfilesrc.h: Add "sequential" property, off by default, to use madvise and hint to the kernel that sequential access is desired. Touch all retrieved pages by default to ensure they are pulled into memory. (Closes #345720)