Commit f287b980 authored by alwu's avatar alwu
Browse files

Bug 1605699 - add more assertions to see if sample's attributes are still...

Bug 1605699 - add more assertions to see if sample's attributes are still valid before we return it via `GetSample()`. r=bryce

In D58392 and D58393, we already added some assertions to ensure that (1) sample is valid when it got added (2) sample is valid when we call `GetSample()`.

However, the crash still exists and doesn't hit these two places. So another possible situation is that samples become invalid during modification before we return it via `GetSample()`.

Therefore, add more assertion to see my guess is correct or not.

Differential Revision: https://phabricator.services.mozilla.com/D126722
parent 894af742
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2263,6 +2263,7 @@ uint32_t TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
      }
      MOZ_ASSERT(startTime > sample->mTime);
      sample->mDuration = startTime - sample->mTime;
      MOZ_DIAGNOSTIC_ASSERT(sample->mDuration.IsValid());
      MSE_DEBUGV("partial overwrite of frame [%" PRId64 ",%" PRId64
                 "] with [%" PRId64 ",%" PRId64
                 "] trim to "
@@ -2763,6 +2764,7 @@ already_AddRefed<MediaRawData> TrackBuffersManager::GetSample(
    aResult = MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__);
    return nullptr;
  }
  MOZ_DIAGNOSTIC_ASSERT(p->HasValidTime());

  // Find the previous keyframe to calculate the evictable amount.
  uint32_t i = trackData.mNextGetSampleIndex.ref();