Bug 1295352 - Check state in MediaEngines' NotifyPull(). r=jesup

GetEndOfAppendedData() returns null and calls a NS_ERROR() if the track we're
looking for doesn't exist - to indicate an error in the caller's code.

When we end a MediaEngine track we set the state to stopped, which we can use
to guard the calls to GetEndOfAppendedData() (and appending data in general).
The locking is already in place.

MozReview-Commit-ID: DuknmBF883H

--HG--
extra : rebase_source : 28b6664ce150f70cd8cd650ed71b86357ac0bd9a
extra : intermediate-source : f14bb9ac87468f5df95941eb03174fe1338855cc
extra : source : df194bbc13b651b94b550e281c6d8cae49ce3324
This commit is contained in:
Andreas Pehrson 2016-08-23 10:45:09 +02:00
parent 7e04b54123
commit 161f548724
2 changed files with 7 additions and 0 deletions

View File

@ -335,6 +335,10 @@ MediaEngineRemoteVideoSource::NotifyPull(MediaStreamGraph* aGraph,
VideoSegment segment;
MonitorAutoLock lock(mMonitor);
if (mState != kStarted) {
return;
}
StreamTime delta = aDesiredTime - aSource->GetEndOfAppendedData(aID);
if (delta > 0) {

View File

@ -213,6 +213,9 @@ MediaEngineTabVideoSource::NotifyPull(MediaStreamGraph*,
{
VideoSegment segment;
MonitorAutoLock mon(mMonitor);
if (mState != kStarted) {
return;
}
// Note: we're not giving up mImage here
RefPtr<layers::SourceSurfaceImage> image = mImage;