Skip to content

Commit

Permalink
Only remove cues early, that are part or the pending importer
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Apr 29, 2023
1 parent 2e2dfc5 commit 2ffed46
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/track/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,9 +1065,15 @@ Track::ImportStatus Track::importCueInfos(
<< "cue(s) is pending until the actual sample rate becomes available";
// Clear all existing cue points, that are supposed
// to be replaced with the imported cue points soon.
QList<CuePointer> cuePoints;
for (const CuePointer& pCue : qAsConst(m_cuePoints)) {
if (!m_pCueInfoImporterPending->hasCueOfType(pCue->getType())) {
cuePoints.append(pCue);
}
}
setCuePointsMarkDirtyAndUnlock(
&lock,
QList<CuePointer>{});
cuePoints);
return ImportStatus::Pending;
}
}
Expand All @@ -1084,11 +1090,6 @@ bool Track::setCuePointsWhileLocked(const QList<CuePointer>& cuePoints) {
// Nothing to do
return false;
}
// Prevent inconsistencies between cue infos that have been queued
// and are waiting to be imported and new cue points. At least one
// of these two collections must be empty.
DEBUG_ASSERT(cuePoints.isEmpty() || !m_pCueInfoImporterPending ||
m_pCueInfoImporterPending->isEmpty());
// disconnect existing cue points
for (const auto& pCue : qAsConst(m_cuePoints)) {
disconnect(pCue.get(), nullptr, this, nullptr);
Expand Down Expand Up @@ -1611,7 +1612,6 @@ void Track::updateStreamInfoFromSource(

auto cuesImported = false;
if (importCueInfos) {
DEBUG_ASSERT(m_cuePoints.isEmpty());
kLogger.debug()
<< "Finishing deferred import of"
<< m_pCueInfoImporterPending->size()
Expand Down

0 comments on commit 2ffed46

Please sign in to comment.