bool WMFReader::InitializeDXVA() { if (!Preferences::GetBool("media.windows-media-foundation.use-dxva", false)) { return false; } MOZ_ASSERT(mDecoder->GetImageContainer()); // Extract the layer manager backend type so that we can determine // whether it's worthwhile using DXVA. If we're not running with a D3D // layer manager then the readback of decoded video frames from GPU to // CPU memory grinds painting to a halt, and makes playback performance // *worse*. MediaDecoderOwner* owner = mDecoder->GetOwner(); NS_ENSURE_TRUE(owner, false); HTMLMediaElement* element = owner->GetMediaElement(); NS_ENSURE_TRUE(element, false); nsRefPtr<LayerManager> layerManager = nsContentUtils::LayerManagerForDocument(element->OwnerDoc()); NS_ENSURE_TRUE(layerManager, false); if (layerManager->GetBackendType() != LayersBackend::LAYERS_D3D9 && layerManager->GetBackendType() != LayersBackend::LAYERS_D3D10) { return false; } mDXVA2Manager = DXVA2Manager::Create(); return mDXVA2Manager != nullptr; }
void MediaDecoder::OnDecoderDoctorEvent(DecoderDoctorEvent aEvent) { MOZ_ASSERT(NS_IsMainThread()); // OnDecoderDoctorEvent is disconnected at shutdown time. MOZ_DIAGNOSTIC_ASSERT(!IsShutdown()); HTMLMediaElement* element = mOwner->GetMediaElement(); if (!element) { return; } nsIDocument* doc = element->OwnerDoc(); if (!doc) { return; } DecoderDoctorDiagnostics diags; diags.StoreEvent(doc, aEvent, __func__); }