зеркало из https://github.com/mozilla/pjs.git
Bug 753852. Don't try to notify the graph to perform its next iteration if this stream has been removed from the graph. r=jesup
This commit is contained in:
Родитель
85afd27d5b
Коммит
8e35557e63
|
@ -1794,35 +1794,45 @@ MediaStream::RemoveListener(MediaStreamListener* aListener)
|
|||
}
|
||||
|
||||
void
|
||||
SourceMediaStream::AddTrack(TrackID aID, TrackRate aRate, TrackTicks aStart,
|
||||
MediaSegment* aSegment)
|
||||
SourceMediaStream::DestroyImpl()
|
||||
{
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
TrackData* data = mUpdateTracks.AppendElement();
|
||||
data->mID = aID;
|
||||
data->mRate = aRate;
|
||||
data->mStart = aStart;
|
||||
data->mCommands = TRACK_CREATE;
|
||||
data->mData = aSegment;
|
||||
data->mHaveEnough = false;
|
||||
mDestroyed = true;
|
||||
}
|
||||
MediaStream::DestroyImpl();
|
||||
}
|
||||
|
||||
void
|
||||
SourceMediaStream::AddTrack(TrackID aID, TrackRate aRate, TrackTicks aStart,
|
||||
MediaSegment* aSegment)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
TrackData* data = mUpdateTracks.AppendElement();
|
||||
data->mID = aID;
|
||||
data->mRate = aRate;
|
||||
data->mStart = aStart;
|
||||
data->mCommands = TRACK_CREATE;
|
||||
data->mData = aSegment;
|
||||
data->mHaveEnough = false;
|
||||
if (!mDestroyed) {
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
|
||||
void
|
||||
SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment)
|
||||
{
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
TrackData *track = FindDataForTrack(aID);
|
||||
if (track) {
|
||||
track->mData->AppendFrom(aSegment);
|
||||
} else {
|
||||
NS_ERROR("Append to non-existant track!");
|
||||
}
|
||||
MutexAutoLock lock(mMutex);
|
||||
TrackData *track = FindDataForTrack(aID);
|
||||
if (track) {
|
||||
track->mData->AppendFrom(aSegment);
|
||||
} else {
|
||||
NS_ERROR("Append to non-existent track!");
|
||||
}
|
||||
if (!mDestroyed) {
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1858,36 +1868,36 @@ SourceMediaStream::DispatchWhenNotEnoughBuffered(TrackID aID,
|
|||
void
|
||||
SourceMediaStream::EndTrack(TrackID aID)
|
||||
{
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
TrackData *track = FindDataForTrack(aID);
|
||||
if (track) {
|
||||
track->mCommands |= TRACK_END;
|
||||
} else {
|
||||
NS_ERROR("End of non-existant track");
|
||||
}
|
||||
MutexAutoLock lock(mMutex);
|
||||
TrackData *track = FindDataForTrack(aID);
|
||||
if (track) {
|
||||
track->mCommands |= TRACK_END;
|
||||
} else {
|
||||
NS_ERROR("End of non-existant track");
|
||||
}
|
||||
if (!mDestroyed) {
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
|
||||
void
|
||||
SourceMediaStream::AdvanceKnownTracksTime(StreamTime aKnownTime)
|
||||
{
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mUpdateKnownTracksTime = aKnownTime;
|
||||
MutexAutoLock lock(mMutex);
|
||||
mUpdateKnownTracksTime = aKnownTime;
|
||||
if (!mDestroyed) {
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
|
||||
void
|
||||
SourceMediaStream::Finish()
|
||||
{
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mUpdateFinished = true;
|
||||
MutexAutoLock lock(mMutex);
|
||||
mUpdateFinished = true;
|
||||
if (!mDestroyed) {
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
|
||||
static const PRUint32 kThreadLimit = 4;
|
||||
|
|
|
@ -371,11 +371,14 @@ class SourceMediaStream : public MediaStream {
|
|||
public:
|
||||
SourceMediaStream(nsDOMMediaStream* aWrapper) :
|
||||
MediaStream(aWrapper), mMutex("mozilla::media::SourceMediaStream"),
|
||||
mUpdateKnownTracksTime(0), mUpdateFinished(false)
|
||||
mUpdateKnownTracksTime(0), mUpdateFinished(false), mDestroyed(false)
|
||||
{}
|
||||
|
||||
virtual SourceMediaStream* AsSourceStream() { return this; }
|
||||
|
||||
// Media graph thread only
|
||||
virtual void DestroyImpl();
|
||||
|
||||
// Call these on any thread.
|
||||
/**
|
||||
* Add a new track to the stream starting at the given base time (which
|
||||
|
@ -467,11 +470,14 @@ protected:
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
// This must be acquired *before* MediaStreamGraphImpl's lock, if they are
|
||||
// held together.
|
||||
Mutex mMutex;
|
||||
// protected by mMutex
|
||||
StreamTime mUpdateKnownTracksTime;
|
||||
nsTArray<TrackData> mUpdateTracks;
|
||||
bool mUpdateFinished;
|
||||
bool mDestroyed;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче