diff -Nru totem-pl-parser-3.26.0/debian/changelog totem-pl-parser-3.26.0/debian/changelog --- totem-pl-parser-3.26.0/debian/changelog 2017-10-27 03:34:18.000000000 +0800 +++ totem-pl-parser-3.26.0/debian/changelog 2017-10-31 17:07:46.000000000 +0800 @@ -1,3 +1,10 @@ +totem-pl-parser (3.26.0-1ubuntu2) UNRELEASED; urgency=medium + + * totem-pl-parser-xspf.c: Avoid large stutters in video playback due to + heavy (and unnecessary) disk syncing (LP: #1698270) + + -- Daniel van Vugt Tue, 31 Oct 2017 17:07:46 +0800 + totem-pl-parser (3.26.0-1ubuntu1) bionic; urgency=low * Merge from Debian unstable. Remaining changes: diff -Nru totem-pl-parser-3.26.0/debian/patches/0001-Avoid-fsync-that-causes-totem-hangs-stutter.patch totem-pl-parser-3.26.0/debian/patches/0001-Avoid-fsync-that-causes-totem-hangs-stutter.patch --- totem-pl-parser-3.26.0/debian/patches/0001-Avoid-fsync-that-causes-totem-hangs-stutter.patch 1970-01-01 08:00:00.000000000 +0800 +++ totem-pl-parser-3.26.0/debian/patches/0001-Avoid-fsync-that-causes-totem-hangs-stutter.patch 2017-10-31 17:07:46.000000000 +0800 @@ -0,0 +1,35 @@ +Description: Avoid fsync() that causes totem hangs/stutter + fsync is just too slow (200ms) to be used in a rendering loop that needs to + display a new video frame every 16ms. +Author: Daniel van Vugt +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1698270 +Bug: https://bugzilla.gnome.org/show_bug.cgi?id=733780 +Forwarded: yes +Last-Update: 2017-10-20 + +diff --git a/plparse/totem-pl-parser-xspf.c b/plparse/totem-pl-parser-xspf.c +index c0d818b..fce2e1b 100644 +--- a/plparse/totem-pl-parser-xspf.c ++++ b/plparse/totem-pl-parser-xspf.c +@@ -107,6 +107,18 @@ totem_pl_parser_save_xspf (TotemPlParser *parser, + char *buf; + gboolean valid, success; + ++ /* Ensure we delete the file before g_file_replace. While this sounds ++ * like a waste of time, it actually saves a lot of time. The reason ++ * is that g_file_replace will later incur an fsync() on close (the ++ * g_object_unref call) if the file existed at the time it was opened ++ * (the g_file_replace call). ++ * The problem with fsync is that it blocks us for up to 200ms or ++ * so even with an SSD. And we need smooth media playback more than the ++ * guarantee of having an old playlist on disk after the disk fills up ++ * or fails. ++ * P.S. G_FILE_CREATE_REPLACE_DESTINATION is not adequate for this. ++ */ ++ g_file_delete (output, NULL, NULL); + stream = g_file_replace (output, NULL, FALSE, G_FILE_CREATE_NONE, NULL, error); + if (stream == NULL) + return FALSE; +-- +2.14.1 + diff -Nru totem-pl-parser-3.26.0/debian/patches/series totem-pl-parser-3.26.0/debian/patches/series --- totem-pl-parser-3.26.0/debian/patches/series 2017-10-17 00:03:39.000000000 +0800 +++ totem-pl-parser-3.26.0/debian/patches/series 2017-10-31 17:07:46.000000000 +0800 @@ -0,0 +1 @@ +0001-Avoid-fsync-that-causes-totem-hangs-stutter.patch