зеркало из https://github.com/mozilla/gecko-dev.git
b=932400 remove refcount manipulation of streams when reordering for processing r=roc
--HG-- extra : rebase_source : f99f4220b53a28a32e9a294b67f4db6218113d73
This commit is contained in:
Родитель
d8e03d0460
Коммит
7db34c314d
|
@ -90,7 +90,7 @@ void
|
|||
MediaStreamGraphImpl::AddStream(MediaStream* aStream)
|
||||
{
|
||||
aStream->mBufferStartTime = mCurrentTime;
|
||||
*mStreams.AppendElement() = already_AddRefed<MediaStream>(aStream);
|
||||
mStreams.AppendElement(aStream);
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("Adding media stream %p to the graph", aStream));
|
||||
|
||||
SetStreamOrderDirty();
|
||||
|
@ -113,8 +113,8 @@ MediaStreamGraphImpl::RemoveStream(MediaStream* aStream)
|
|||
|
||||
SetStreamOrderDirty();
|
||||
|
||||
// This unrefs the stream, probably destroying it
|
||||
mStreams.RemoveElement(aStream);
|
||||
NS_RELEASE(aStream); // probably destroying it
|
||||
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("Removing media stream %p from the graph", aStream));
|
||||
}
|
||||
|
@ -532,9 +532,9 @@ MediaStreamGraphImpl::MarkConsumed(MediaStream* aStream)
|
|||
|
||||
void
|
||||
MediaStreamGraphImpl::UpdateStreamOrderForStream(mozilla::LinkedList<MediaStream>* aStack,
|
||||
already_AddRefed<MediaStream> aStream)
|
||||
MediaStream* aStream)
|
||||
{
|
||||
nsRefPtr<MediaStream> stream = aStream;
|
||||
MediaStream* stream = aStream;
|
||||
NS_ASSERTION(!stream->mHasBeenOrdered, "stream should not have already been ordered");
|
||||
if (stream->mIsOnOrderingStack) {
|
||||
MediaStream* iter = aStack->getLast();
|
||||
|
@ -582,8 +582,7 @@ MediaStreamGraphImpl::UpdateStreamOrderForStream(mozilla::LinkedList<MediaStream
|
|||
for (uint32_t i = 0; i < ps->mInputs.Length(); ++i) {
|
||||
MediaStream* source = ps->mInputs[i]->mSource;
|
||||
if (!source->mHasBeenOrdered) {
|
||||
nsRefPtr<MediaStream> s = source;
|
||||
UpdateStreamOrderForStream(aStack, s.forget());
|
||||
UpdateStreamOrderForStream(aStack, source);
|
||||
}
|
||||
}
|
||||
aStack->popLast();
|
||||
|
@ -591,7 +590,7 @@ MediaStreamGraphImpl::UpdateStreamOrderForStream(mozilla::LinkedList<MediaStream
|
|||
}
|
||||
|
||||
stream->mHasBeenOrdered = true;
|
||||
*mStreams.AppendElement() = stream.forget();
|
||||
*mStreams.AppendElement() = stream;
|
||||
}
|
||||
|
||||
static void AudioMixerCallback(AudioDataValue* aMixedBuffer,
|
||||
|
@ -646,12 +645,12 @@ MediaStreamGraphImpl::UpdateStreamOrder()
|
|||
|
||||
mozilla::LinkedList<MediaStream> stack;
|
||||
for (uint32_t i = 0; i < mOldStreams.Length(); ++i) {
|
||||
nsRefPtr<MediaStream>& s = mOldStreams[i];
|
||||
MediaStream* s = mOldStreams[i];
|
||||
if (s->IsIntrinsicallyConsumed()) {
|
||||
MarkConsumed(s);
|
||||
}
|
||||
if (!s->mHasBeenOrdered) {
|
||||
UpdateStreamOrderForStream(&stack, s.forget());
|
||||
UpdateStreamOrderForStream(&stack, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ public:
|
|||
* its children.
|
||||
*/
|
||||
void UpdateStreamOrderForStream(mozilla::LinkedList<MediaStream>* aStack,
|
||||
already_AddRefed<MediaStream> aStream);
|
||||
MediaStream* aStream);
|
||||
/**
|
||||
* Mark aStream and all its inputs (recursively) as consumed.
|
||||
*/
|
||||
|
@ -426,12 +426,17 @@ public:
|
|||
// mLifecycleState > LIFECYCLE_RUNNING in which case the graph thread
|
||||
// is not running and this state can be used from the main thread.
|
||||
|
||||
nsTArray<nsRefPtr<MediaStream> > mStreams;
|
||||
/**
|
||||
* The graph keeps a reference to each stream.
|
||||
* References are maintained manually to simplify reordering without
|
||||
* unnecessary thread-safe refcount changes.
|
||||
*/
|
||||
nsTArray<MediaStream*> mStreams;
|
||||
/**
|
||||
* mOldStreams is used as temporary storage for streams when computing the
|
||||
* order in which we compute them.
|
||||
*/
|
||||
nsTArray<nsRefPtr<MediaStream> > mOldStreams;
|
||||
nsTArray<MediaStream*> mOldStreams;
|
||||
/**
|
||||
* The current graph time for the current iteration of the RunThread control
|
||||
* loop.
|
||||
|
|
Загрузка…
Ссылка в новой задаче