diff --git a/0001-libMirage-SNDFILE-filter-instead-of-a-single-frame-c.patch b/0001-libMirage-SNDFILE-filter-instead-of-a-single-frame-c.patch new file mode 100644 index 0000000..a8b953d --- /dev/null +++ b/0001-libMirage-SNDFILE-filter-instead-of-a-single-frame-c.patch @@ -0,0 +1,120 @@ +From 79e017c9e196a1e4f0be649d265be8060257bee4 Mon Sep 17 00:00:00 2001 +From: Rok Mandeljc +Date: Thu, 7 Mar 2013 23:13:23 +0100 +Subject: [PATCH] libMirage: SNDFILE filter: instead of a single frame, cache + blocks of 588 frames, which is equivalent of one CD-ROM + audio sector. This way, caching is much more efficient, and + consequently reduces CPU load. Fix for bug #60. + +Edit by Jan Engelhardt +Increase buffer size even more (see bug #60); +to 2 seconds, to resolve more dropouts. + +--- + .../filter-sndfile/filter-sndfile-file-filter.c | 43 +++++++++++--------- + 1 file changed, 23 insertions(+), 20 deletions(-) + +diff --git a/libmirage/src/filters/filter-sndfile/filter-sndfile-file-filter.c b/libmirage/src/filters/filter-sndfile/filter-sndfile-file-filter.c +index a92f7ae..78c465f 100644 +--- a/libmirage/src/filters/filter-sndfile/filter-sndfile-file-filter.c ++++ b/libmirage/src/filters/filter-sndfile/filter-sndfile-file-filter.c +@@ -21,6 +21,9 @@ + + #define __debug__ "SNDFILE-FileFilter" + ++/* Number of frames to cache */ ++#define NUM_FRAMES 588*75*2 ++ + + /**********************************************************************\ + * Private structure * +@@ -35,7 +38,7 @@ struct _MirageFileFilterSndfilePrivate + gint buflen; + guint8 *buffer; + +- gint cached_frame; ++ gint cached_block; + }; + + +@@ -143,7 +146,7 @@ static gboolean mirage_file_filter_sndfile_can_handle_data_format (MirageFileFil + mirage_file_filter_set_file_size(MIRAGE_FILE_FILTER(self), length); + + /* Allocate read buffer; we wish to hold a single (multichannel) frame */ +- self->priv->buflen = self->priv->format.channels * sizeof(guint16); ++ self->priv->buflen = self->priv->format.channels * sizeof(guint16) * NUM_FRAMES; + MIRAGE_DEBUG(self, MIRAGE_DEBUG_PARSER, "%s: buffer length: %d bytes\n", __debug__, self->priv->buflen); + self->priv->buffer = g_try_malloc(self->priv->buflen); + if (!self->priv->buffer) { +@@ -158,42 +161,42 @@ static gssize mirage_file_filter_sndfile_partial_read (MirageFileFilter *_self, + { + MirageFileFilterSndfile *self = MIRAGE_FILE_FILTER_SNDFILE(_self); + goffset position = mirage_file_filter_get_position(MIRAGE_FILE_FILTER(self)); +- gint frame; ++ gint block; + +- /* Find the frame corresponding to current position */ +- frame = position / self->priv->buflen; +- MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: stream position: %ld (0x%lX) -> frame #%d (cached: #%d)\n", __debug__, position, position, frame, self->priv->cached_frame); ++ /* Find the block of frames corresponding to current position */ ++ block = position / self->priv->buflen; ++ MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: stream position: %ld (0x%lX) -> block #%d (cached: #%d)\n", __debug__, position, position, block, self->priv->cached_block); + +- /* If we do not have block in cache, uncompress it */ +- if (frame != self->priv->cached_frame) { ++ /* If we do not have block in cache, read it */ ++ if (block != self->priv->cached_block) { + gsize read_length; + +- MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: frame not cached, reading...\n", __debug__); ++ MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: block not cached, reading...\n", __debug__); + +- /* Seek to frame */ +- sf_seek(self->priv->sndfile, frame, SEEK_SET); ++ /* Seek to beginning of block */ ++ sf_seek(self->priv->sndfile, block*NUM_FRAMES, SEEK_SET); + + /* Read the frame */ +- read_length = sf_readf_short(self->priv->sndfile, (short *)self->priv->buffer, 1); ++ read_length = sf_readf_short(self->priv->sndfile, (short *)self->priv->buffer, NUM_FRAMES); + + if (!read_length) { +- MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: frame not read; EOF reached?\n", __debug__); ++ MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: block not read; EOF reached?\n", __debug__); + return 0; + } + + /* Store the number of currently stored block */ +- self->priv->cached_frame = frame; ++ self->priv->cached_block = block; + } else { +- MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: frame already cached\n", __debug__); ++ MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: block already cached\n", __debug__); + } + + /* Copy data */ +- goffset frame_offset = position % self->priv->buflen; +- count = MIN(count, self->priv->buflen - frame_offset); ++ goffset block_offset = position % self->priv->buflen; ++ count = MIN(count, self->priv->buflen - block_offset); + +- MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: offset within frame: %ld, copying %d bytes\n", __debug__, frame_offset, count); ++ MIRAGE_DEBUG(self, MIRAGE_DEBUG_FILE_IO, "%s: offset within block: %ld, copying %d bytes\n", __debug__, block_offset, count); + +- memcpy(buffer, self->priv->buffer + frame_offset, count); ++ memcpy(buffer, self->priv->buffer + block_offset, count); + + return count; + } +@@ -220,7 +223,7 @@ static void mirage_file_filter_sndfile_init (MirageFileFilterSndfile *self) + 0 + ); + +- self->priv->cached_frame = -1; ++ self->priv->cached_block = -1; + + self->priv->sndfile = NULL; + self->priv->buffer = NULL; +-- +1.7.10.4 + diff --git a/libmirage-2.0.0.tar.bz2 b/libmirage-2.0.0.tar.bz2 deleted file mode 100644 index c39c71e..0000000 --- a/libmirage-2.0.0.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:154003160e46d33af6d265d8fe03972924b2bc8326fd3572e7138b818f4b5a65 -size 178529 diff --git a/libmirage-2.0.0.tar.xz b/libmirage-2.0.0.tar.xz new file mode 100644 index 0000000..3a42fdb --- /dev/null +++ b/libmirage-2.0.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8dffdca4bf8bc8decdb9ae674b18f6008665572505de57e544a26d251d7c776e +size 181808 diff --git a/libmirage.changes b/libmirage.changes index 2424d34..c3ebcdd 100644 --- a/libmirage.changes +++ b/libmirage.changes @@ -1,9 +1,17 @@ +------------------------------------------------------------------- +Tue Mar 12 09:30:09 UTC 2013 - jengelh@inai.de + +- Add 0001-libMirage-SNDFILE-filter-instead-of-a-single-frame-c.patch + to resolve excess CPU usage during CDDA readout + (bnc#809181, bnc#809862) + ------------------------------------------------------------------- Sun Feb 24 20:08:18 UTC 2013 - jengelh@inai.de - Add 0001-libMirage-READCD-Parser-when-verifying-the-file-don-.patch 0001-libMirage-READCD-Parser-readcd-from-cdrtools-appears.patch to make images created by readcd(1) usable again + (bugurl: http://sf.net/p/cdemu/feature-requests/21/) ------------------------------------------------------------------- Sat Jan 5 21:47:42 UTC 2013 - jengelh@inai.de diff --git a/libmirage.spec b/libmirage.spec index e34201b..74eb313 100644 --- a/libmirage.spec +++ b/libmirage.spec @@ -28,10 +28,12 @@ Url: http://cdemu.sf.net/ #Freecode-URL: https://freecode.com/projects/cdemu-for-linux #Git-Clone: git://git.code.sf.net/p/cdemu/code -Source: http://downloads.sf.net/cdemu/%name-%version.tar.bz2 +#DL-URL: http://downloads.sf.net/cdemu/%name-%version.tar.bz2 +Source: %name-%version.tar.xz Patch1: 0001-libMirage-CMake-fix-SOVERSION-which-should-be-set-to.patch Patch2: 0001-libMirage-READCD-Parser-when-verifying-the-file-don-.patch Patch3: 0001-libMirage-READCD-Parser-readcd-from-cdrtools-appears.patch +Patch4: 0001-libMirage-SNDFILE-filter-instead-of-a-single-frame-c.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: cmake >= 2.8.5 BuildRequires: pkgconfig >= 0.16 @@ -131,7 +133,7 @@ This package provides the GObject Introspection bindings for libmirage. %prep %setup -Tcqa0 -%patch -P 1 -P 2 -P 3 -p2 +%patch -P 1 -P 2 -P 3 -P 4 -p2 %build # gir is busted on 12.1