Backed out changeset 4757a1d4a23e (bug 1113282) for e10s M1 test failures

This commit is contained in:
Carsten "Tomcat" Book 2014-12-19 09:00:07 +01:00
parent b618f038f4
commit 8ad1c2cafd
3 changed files with 8 additions and 34 deletions

View File

@ -327,7 +327,6 @@ MediaSourceReader::Shutdown()
void void
MediaSourceReader::ContinueShutdown() MediaSourceReader::ContinueShutdown()
{ {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
if (mTrackBuffers.Length()) { if (mTrackBuffers.Length()) {
mTrackBuffers[0]->Shutdown()->Then(GetTaskQueue(), __func__, this, mTrackBuffers[0]->Shutdown()->Then(GetTaskQueue(), __func__, this,
&MediaSourceReader::ContinueShutdown, &MediaSourceReader::ContinueShutdown,

View File

@ -39,14 +39,12 @@ TrackBuffer::TrackBuffer(MediaSourceDecoder* aParentDecoder, const nsACString& a
: mParentDecoder(aParentDecoder) : mParentDecoder(aParentDecoder)
, mType(aType) , mType(aType)
, mLastStartTimestamp(0) , mLastStartTimestamp(0)
, mShutdown(false)
{ {
MOZ_COUNT_CTOR(TrackBuffer); MOZ_COUNT_CTOR(TrackBuffer);
mParser = ContainerParser::CreateForMIMEType(aType); mParser = ContainerParser::CreateForMIMEType(aType);
mTaskQueue = new MediaTaskQueue(GetMediaDecodeThreadPool()); mTaskQueue = new MediaTaskQueue(GetMediaDecodeThreadPool());
aParentDecoder->AddTrackBuffer(this); aParentDecoder->AddTrackBuffer(this);
mDecoderPerSegment = Preferences::GetBool("media.mediasource.decoder-per-segment", false); mDecoderPerSegment = Preferences::GetBool("media.mediasource.decoder-per-segment", false);
MSE_DEBUG("TrackBuffer(%p) created for parent decoder %p", this, aParentDecoder);
} }
TrackBuffer::~TrackBuffer() TrackBuffer::~TrackBuffer()
@ -103,9 +101,6 @@ private:
nsRefPtr<ShutdownPromise> nsRefPtr<ShutdownPromise>
TrackBuffer::Shutdown() TrackBuffer::Shutdown()
{ {
mParentDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
mShutdown = true;
MOZ_ASSERT(mShutdownPromise.IsEmpty()); MOZ_ASSERT(mShutdownPromise.IsEmpty());
nsRefPtr<ShutdownPromise> p = mShutdownPromise.Ensure(__func__); nsRefPtr<ShutdownPromise> p = mShutdownPromise.Ensure(__func__);
@ -375,42 +370,23 @@ TrackBuffer::QueueInitializeDecoder(SourceBufferDecoder* aDecoder)
void void
TrackBuffer::InitializeDecoder(SourceBufferDecoder* aDecoder) TrackBuffer::InitializeDecoder(SourceBufferDecoder* aDecoder)
{ {
// ReadMetadata may block the thread waiting on data, so we must be able
// to leave the monitor while we call it. For the rest of this function
// we want to hold the monitor though, since we run on a different task queue
// from the reader and interact heavily with it.
mParentDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn();
ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
// We may be shut down at any time by the reader on another thread. So we need
// to check for this each time we acquire the monitor. If that happens, we
// need to abort immediately, because the reader has forgotten about us, and
// important pieces of our state (like mTaskQueue) have also been torn down.
if (mShutdown) {
MSE_DEBUG("TrackBuffer(%p) was shut down. Aborting initialization.", this);
return;
}
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
// ReadMetadata may block the thread waiting on data, so it must not be
// called with the monitor held.
mParentDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn();
MediaDecoderReader* reader = aDecoder->GetReader(); MediaDecoderReader* reader = aDecoder->GetReader();
MSE_DEBUG("TrackBuffer(%p): Initializing subdecoder %p reader %p", MSE_DEBUG("TrackBuffer(%p): Initializing subdecoder %p reader %p",
this, aDecoder, reader); this, aDecoder, reader);
MediaInfo mi; MediaInfo mi;
nsAutoPtr<MetadataTags> tags; // TODO: Handle metadata. nsAutoPtr<MetadataTags> tags; // TODO: Handle metadata.
nsresult rv; nsresult rv = reader->ReadMetadata(&mi, getter_Transfers(tags));
{
ReentrantMonitorAutoExit mon(mParentDecoder->GetReentrantMonitor());
rv = reader->ReadMetadata(&mi, getter_Transfers(tags));
}
reader->SetIdle(); reader->SetIdle();
if (mShutdown) {
MSE_DEBUG("TrackBuffer(%p) was shut down while reading metadata. Aborting initialization.", this);
return;
}
if (NS_SUCCEEDED(rv) && reader->IsWaitingOnCDMResource()) { if (NS_SUCCEEDED(rv) && reader->IsWaitingOnCDMResource()) {
ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
mWaitingDecoders.AppendElement(aDecoder); mWaitingDecoders.AppendElement(aDecoder);
return; return;
} }
@ -466,7 +442,7 @@ TrackBuffer::ValidateTrackFormats(const MediaInfo& aInfo)
bool bool
TrackBuffer::RegisterDecoder(SourceBufferDecoder* aDecoder) TrackBuffer::RegisterDecoder(SourceBufferDecoder* aDecoder)
{ {
mParentDecoder->GetReentrantMonitor().AssertCurrentThreadIn(); ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
const MediaInfo& info = aDecoder->GetReader()->GetMediaInfo(); const MediaInfo& info = aDecoder->GetReader()->GetMediaInfo();
// Initialize the track info since this is the first decoder. // Initialize the track info since this is the first decoder.
if (mInitializedDecoders.IsEmpty()) { if (mInitializedDecoders.IsEmpty()) {

View File

@ -163,7 +163,6 @@ private:
void ContinueShutdown(); void ContinueShutdown();
MediaPromiseHolder<ShutdownPromise> mShutdownPromise; MediaPromiseHolder<ShutdownPromise> mShutdownPromise;
bool mDecoderPerSegment; bool mDecoderPerSegment;
bool mShutdown;
}; };
} // namespace mozilla } // namespace mozilla