Fix crash when rendering with audio muted

BUG: 363328
parent fedc07cb
...@@ -256,9 +256,10 @@ bool Timeline::checkProjectAudio() ...@@ -256,9 +256,10 @@ bool Timeline::checkProjectAudio()
{ {
bool hasAudio = false; bool hasAudio = false;
int max = m_tracks.count(); int max = m_tracks.count();
for (int i = 0; i < max; i++) { // Ignore black background track, start at one
for (int i = 1; i < max; i++) {
Track *sourceTrack = track(i); Track *sourceTrack = track(i);
QScopedPointer<Mlt::Producer> track(m_tractor->track(i + 1)); QScopedPointer<Mlt::Producer> track(m_tractor->track(i));
int state = track->get_int("hide"); int state = track->get_int("hide");
if (sourceTrack && sourceTrack->hasAudio() && !(state & 2)) { if (sourceTrack && sourceTrack->hasAudio() && !(state & 2)) {
hasAudio = true; hasAudio = true;
...@@ -689,7 +690,7 @@ QList <TrackInfo> Timeline::getTracksInfo() ...@@ -689,7 +690,7 @@ QList <TrackInfo> Timeline::getTracksInfo()
QStringList Timeline::getTrackNames() QStringList Timeline::getTrackNames()
{ {
QStringList trackNames; QStringList trackNames;
for (int i = 0; i < tracksCount(); i++) { for (int i = 1; i < tracksCount(); i++) {
trackNames << track(i)->info().trackName; trackNames << track(i)->info().trackName;
} }
return trackNames; return trackNames;
...@@ -1519,7 +1520,8 @@ QPoint Timeline::getTracksCount() ...@@ -1519,7 +1520,8 @@ QPoint Timeline::getTracksCount()
int audioTracks = 0; int audioTracks = 0;
int videoTracks = 0; int videoTracks = 0;
int max = m_tracks.count(); int max = m_tracks.count();
for (int i = 0; i < max; i++) { // Ignore black background track, start at one
for (int i = 1; i < max; i++) {
Track *tk = track(i); Track *tk = track(i);
if (tk->type == AudioTrack) audioTracks++; if (tk->type == AudioTrack) audioTracks++;
else videoTracks++; else videoTracks++;
...@@ -1538,7 +1540,7 @@ int Timeline::getTrackSpaceLength(int trackIndex, int pos, bool fromBlankStart) ...@@ -1538,7 +1540,7 @@ int Timeline::getTrackSpaceLength(int trackIndex, int pos, bool fromBlankStart)
void Timeline::updateClipProperties(const QString &id, QMap <QString, QString> properties) void Timeline::updateClipProperties(const QString &id, QMap <QString, QString> properties)
{ {
for (int i = 0; i< m_tracks.count(); i++) { for (int i = 1; i< m_tracks.count(); i++) {
track(i)->updateClipProperties(id, properties); track(i)->updateClipProperties(id, properties);
} }
} }
...@@ -1611,7 +1613,7 @@ int Timeline::getSpaceLength(const GenTime &pos, int tk, bool fromBlankStart) ...@@ -1611,7 +1613,7 @@ int Timeline::getSpaceLength(const GenTime &pos, int tk, bool fromBlankStart)
void Timeline::disableTimelineEffects(bool disable) void Timeline::disableTimelineEffects(bool disable)
{ {
for (int i = 0; i< tracksCount(); i++) { for (int i = 1; i< tracksCount(); i++) {
track(i)->disableEffects(disable); track(i)->disableEffects(disable);
} }
} }
......
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