Bug 945645 - Only init WMF video decoding if we have a video container. r=padenot.

This commit is contained in:
Chris Pearce 2014-01-07 14:36:12 +13:00
Родитель d8b99be219
Коммит eb97868f09
1 изменённых файлов: 8 добавлений и 1 удалений

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

@ -105,6 +105,7 @@ 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
@ -151,7 +152,8 @@ WMFReader::Init(MediaDecoderReader* aCloneDonor)
rv = mByteStream->Init();
NS_ENSURE_SUCCESS(rv, rv);
if (IsVideoContentType(mDecoder->GetResource()->GetContentType())) {
if (mDecoder->GetImageContainer() != nullptr &&
IsVideoContentType(mDecoder->GetResource()->GetContentType())) {
mUseHwAccel = InitializeDXVA();
} else {
mUseHwAccel = false;
@ -345,6 +347,11 @@ WMFReader::ConfigureVideoDecoder()
return S_OK;
}
if (!mDecoder->GetImageContainer()) {
// We can't display the video, so don't bother to decode; disable the stream.
return mSourceReader->SetStreamSelection(MF_SOURCE_READER_FIRST_VIDEO_STREAM, FALSE);
}
static const GUID MP4VideoTypes[] = {
MFVideoFormat_H264
};