bug 1257718 replace bailOut variable with more descriptive timeMatchesEventIndex r?padenot
with the new variable matching the loop exit status of interest.
MozReview-Commit-ID: 8xy5ipo4trp
--- a/dom/media/webaudio/AudioEventTimeline.cpp
+++ b/dom/media/webaudio/AudioEventTimeline.cpp
@@ -155,28 +155,27 @@ AudioEventTimeline::GetValuesAtTimeHelpe
// Let's remove old events except the last one: we need it to calculate some curves.
while (mEvents.Length() > 1 &&
aTime > TimeOf(mEvents[1])) {
mEvents.RemoveElementAt(0);
}
for (size_t bufferIndex = 0; bufferIndex < aSize; ++bufferIndex, ++aTime) {
- bool bailOut = false;
+ bool timeMatchesEventIndex = false;
const AudioTimelineEvent* next;
for (; ; ++eventIndex) {
if (eventIndex >= mEvents.Length()) {
next = nullptr;
break;
}
next = &mEvents[eventIndex];
if (aTime < TimeOf(*next)) {
- bailOut = true;
break;
}
#ifdef DEBUG
MOZ_ASSERT(next->mType == AudioTimelineEvent::SetValueAtTime ||
next->mType == AudioTimelineEvent::SetTarget ||
next->mType == AudioTimelineEvent::LinearRamp ||
next->mType == AudioTimelineEvent::ExponentialRamp ||
@@ -185,23 +184,24 @@ AudioEventTimeline::GetValuesAtTimeHelpe
if (TimesEqual(aTime, TimeOf(*next))) {
mLastComputedValue = mComputedValue;
// Find the last event with the same time
while (eventIndex < mEvents.Length() - 1 &&
TimesEqual(aTime, TimeOf(mEvents[eventIndex + 1]))) {
++eventIndex;
}
+ timeMatchesEventIndex = true;
break;
}
previous = next;
}
- if (!bailOut && eventIndex < mEvents.Length()) {
+ if (timeMatchesEventIndex) {
// The time matches one of the events exactly.
MOZ_ASSERT(TimesEqual(aTime, TimeOf(mEvents[eventIndex])));
// SetTarget nodes can be handled no matter what their next node is (if they have one)
if (mEvents[eventIndex].mType == AudioTimelineEvent::SetTarget) {
// Follow the curve, without regard to the next event, starting at
// the last value of the last event.
aBuffer[bufferIndex] = ExponentialApproach(TimeOf(mEvents[eventIndex]),