Fix error in mirror track calculation.

Fixes #276
parent b43b737f
Pipeline #4703 passed with stage
in 14 minutes and 20 seconds
......@@ -421,23 +421,17 @@ int TimelineModel::getMirrorVideoTrackId(int trackId) const
return -1;
}
int count = 0;
if (it != m_allTracks.cend()) {
++it;
}
while (it != m_allTracks.cend()) {
if ((*it)->isAudioTrack()) {
count++;
} else {
count--;
if (count == 0) {
return (*it)->getId();
}
count--;
}
++it;
}
if (it != m_allTracks.cend() && !(*it)->isAudioTrack() && count == 0) {
return (*it)->getId();
}
return -1;
}
......@@ -456,21 +450,22 @@ int TimelineModel::getMirrorAudioTrackId(int trackId) const
auto it = m_iteratorTable.at(trackId);
if ((*it)->isAudioTrack()) {
// we expected a video track...
qDebug()<<"++++++++\n+++++++ ERROR RQSTNG AUDIO MIRROR FOR AUDIO";
return -1;
}
int count = 0;
while (it != m_allTracks.cbegin()) {
--it;
if (!(*it)->isAudioTrack()) {
count++;
} else {
count--;
if (count == 0) {
return (*it)->getId();
}
count--;
}
--it;
}
if ((*it)->isAudioTrack() && count == 0) {
if ((*it)->isAudioTrack() && count == 1) {
return (*it)->getId();
}
return -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment