playbackcache: fixed crash if shift was beyond length

This commit is contained in:
itsmattkc
2021-05-03 13:53:39 +10:00
parent ee6b09f772
commit 20b3fe76a8
2 changed files with 14 additions and 2 deletions
+13 -1
View File
@@ -87,12 +87,24 @@ void PlaybackCache::SetLength(const rational &r)
}
}
void PlaybackCache::Shift(const rational &from, const rational &to)
void PlaybackCache::Shift(rational from, rational to)
{
if (from == to) {
return;
}
if (from > length_) {
if (to > from) {
// No-op
return;
} else if (to >= length_) {
// No-op
return;
} else {
from = length_;
}
}
qDebug() << "FIXME: 0 job time may cause cache desyncs";
// An region between `from` and `to` will be inserted or spliced out