From 052f3a683676c4aee671b2c8d81ab4c8cba35ec1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 6 Dec 2019 23:13:20 +0100 Subject: Speed up seeking in mp3s --- libs/ardour/mp3fileimportable.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/ardour/mp3fileimportable.cc b/libs/ardour/mp3fileimportable.cc index 202ad8493c..99fc0a6384 100644 --- a/libs/ardour/mp3fileimportable.cc +++ b/libs/ardour/mp3fileimportable.cc @@ -158,7 +158,12 @@ Mp3FileImportableSource::seek (samplepos_t pos) } while (_read_position + _n_frames <= pos) { - if (!decode_mp3 ()) { + /* skip ahead, until the frame before the target, + * then start decoding. This provides sufficient + * context to prevent audible hiccups, while still + * providing fast and accurate seeking. + */ + if (!decode_mp3 (_read_position + 3 * _n_frames <= pos)) { break; } _read_position += _n_frames; -- cgit v1.2.3