Bug 1248909: [MSE] P2. Simplify diagnostic. r=gerald

Also, an assert could have been incorrectly triggered, if eviction occurred on a source buffer while data was also being appended to it.

MozReview-Commit-ID: 6gVHZdbL07B
This commit is contained in:
Jean-Yves Avenard 2016-02-18 15:27:48 +11:00
parent b88a6dfa63
commit f04a1e0f1c
2 changed files with 3 additions and 11 deletions

View File

@ -104,7 +104,6 @@ TrackBuffersManager::TrackBuffersManager(dom::SourceBufferAttributes* aAttribute
, mEvictionOccurred(false)
, mMonitor("TrackBuffersManager")
, mAppendRunning(false)
, mSegmentParserLoopRunning(false)
{
MOZ_ASSERT(NS_IsMainThread(), "Must be instanciated on the main thread");
}
@ -301,7 +300,7 @@ void
TrackBuffersManager::CompleteResetParserState()
{
MOZ_ASSERT(OnTaskQueue());
MOZ_DIAGNOSTIC_ASSERT(!mSegmentParserLoopRunning);
MOZ_DIAGNOSTIC_ASSERT(!mAppendRunning, "Append is running");
MSE_DEBUG("");
for (auto& track : GetTracksList()) {
@ -429,6 +428,7 @@ RefPtr<TrackBuffersManager::RangeRemovalPromise>
TrackBuffersManager::CodedFrameRemovalWithPromise(TimeInterval aInterval)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_DIAGNOSTIC_ASSERT(!mAppendRunning, "Logic error: Append in progress");
bool rv = CodedFrameRemoval(aInterval);
return RangeRemovalPromise::CreateAndResolve(rv, __func__);
}
@ -437,7 +437,6 @@ bool
TrackBuffersManager::CodedFrameRemoval(TimeInterval aInterval)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(!mSegmentParserLoopRunning, "Logic error: Append in progress");
MSE_DEBUG("From %.2fs to %.2f",
aInterval.mStart.ToSeconds(), aInterval.mEnd.ToSeconds());
@ -576,8 +575,6 @@ TrackBuffersManager::SegmentParserLoop()
{
MOZ_ASSERT(OnTaskQueue());
mSegmentParserLoopRunning = true;
while (true) {
// 1. If the input buffer is empty, then jump to the need more data step below.
if (!mInputBuffer || mInputBuffer->IsEmpty()) {
@ -702,7 +699,6 @@ TrackBuffersManager::NeedMoreData()
MSE_DEBUG("");
RestoreCachedVariables();
mAppendRunning = false;
mSegmentParserLoopRunning = false;
{
// Wake-up any pending Abort()
MonitorAutoLock mon(mMonitor);
@ -716,7 +712,6 @@ TrackBuffersManager::RejectAppend(nsresult aRejectValue, const char* aName)
{
MSE_DEBUG("rv=%d", aRejectValue);
mAppendRunning = false;
mSegmentParserLoopRunning = false;
{
// Wake-up any pending Abort()
MonitorAutoLock mon(mMonitor);

View File

@ -350,11 +350,8 @@ private:
// Monitor to protect following objects accessed across multipple threads.
// mMonitor is also notified if the value of mAppendRunning becomes false.
mutable Monitor mMonitor;
// Set to true while SegmentParserLoop is running.
// Set to true while a BufferAppend is running or is pending.
Atomic<bool> mAppendRunning;
// Set to true while SegmentParserLoop is running.
// This is for diagnostic only. Only accessed on the task queue.
bool mSegmentParserLoopRunning;
// Stable audio and video track time ranges.
media::TimeIntervals mVideoBufferedRanges;
media::TimeIntervals mAudioBufferedRanges;