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 : 27e79479f182e0612c2c1881fec40ee86f9d6227
extra : histedit_source : 39b17fcdb0389b2eed52ef15ecf11ceea6c21c52
This commit is contained in:
Andreas Pehrson 2016-08-23 10:45:09 +02:00
Родитель 818609964a
Коммит b12d8275c8
3 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -74,8 +74,10 @@ MediaEngineGonkVideoSource::NotifyPull(MediaStreamGraph* aGraph,
MonitorAutoLock lock(mMonitor);
// B2G does AddTrack, but holds kStarted until the hardware changes state.
// So mState could be kReleased here. We really don't care about the state,
// though.
// So mState could be kReleased here.
if (mState != kStarted) {
return;
}
// Note: we're not giving up mImage here
RefPtr<layers::Image> image = mImage;

Просмотреть файл

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

Просмотреть файл

@ -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;