Bug 1141781 - Grip the VideoFrameContainer when queing a call to invalidate in the MediaStreamGraph. r=roc

This commit is contained in:
Paul Adenot 2015-03-16 18:12:36 +01:00
Родитель 60b4c34dcf
Коммит e95766a93b
2 изменённых файлов: 24 добавлений и 7 удалений

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

@ -1084,6 +1084,23 @@ SetImageToBlackPixel(PlanarYCbCrImage* aImage)
aImage->SetData(data);
}
class VideoFrameContainerInvalidateRunnable : public nsRunnable {
public:
explicit VideoFrameContainerInvalidateRunnable(VideoFrameContainer* aVideoFrameContainer)
: mVideoFrameContainer(aVideoFrameContainer)
{}
NS_IMETHOD Run()
{
MOZ_ASSERT(NS_IsMainThread());
mVideoFrameContainer->Invalidate();
return NS_OK;
}
private:
nsRefPtr<VideoFrameContainer> mVideoFrameContainer;
};
void
MediaStreamGraphImpl::PlayVideo(MediaStream* aStream)
{
@ -1147,7 +1164,7 @@ MediaStreamGraphImpl::PlayVideo(MediaStream* aStream)
}
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
new VideoFrameContainerInvalidateRunnable(output);
DispatchToMainThreadAfterStreamStateUpdate(event.forget());
}
if (!aStream->mNotifiedFinished) {

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

@ -630,12 +630,12 @@ void MediaPipelineTransmit::AttachToTrack(const std::string& track_id) {
stream_->AddListener(listener_);
// Is this a gUM mediastream? If so, also register the Listener directly with
// the SourceMediaStream that's attached to the TrackUnion so we can get direct
// unqueued (and not resampled) data
if (domstream_->AddDirectListener(listener_)) {
listener_->direct_connect_ = true;
}
// // Is this a gUM mediastream? If so, also register the Listener directly with
// // the SourceMediaStream that's attached to the TrackUnion so we can get direct
// // unqueued (and not resampled) data
// if (domstream_->AddDirectListener(listener_)) {
// listener_->direct_connect_ = true;
// }
#ifndef MOZILLA_INTERNAL_API
// this enables the unit tests that can't fiddle with principals and the like