diff --git a/decoder/LAVVideo/LAVPixFmtConverter.cpp b/decoder/LAVVideo/LAVPixFmtConverter.cpp index a14478454..fdb1e9276 100644 --- a/decoder/LAVVideo/LAVPixFmtConverter.cpp +++ b/decoder/LAVVideo/LAVPixFmtConverter.cpp @@ -316,6 +316,10 @@ void CLAVPixFmtConverter::GetMediaType(CMediaType *mt, int index, LONG biWidth, { pBIH->biWidth = FFALIGN(biWidth, 48); } + else if ((biWidth & 1) && (guid == MEDIASUBTYPE_NV12 || guid == MEDIASUBTYPE_YV12 || guid == MEDIASUBTYPE_YUY2 || guid == MEDIASUBTYPE_I420)) + { + pBIH->biWidth = FFALIGN(biWidth, 2); + } mt->SetSampleSize(pBIH->biSizeImage); mt->SetTemporalCompression(0); diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index 669219fae..565f631ab 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -1500,6 +1500,10 @@ HRESULT CLAVVideo::ReconnectOutput(int width, int height, AVRational ar, DXVA2_E { pBIH->biWidth = FFALIGN(width, 48); } + else if ((width & 1) && (mt.subtype == MEDIASUBTYPE_NV12 || mt.subtype == MEDIASUBTYPE_YV12 || mt.subtype == MEDIASUBTYPE_YUY2 || mt.subtype == MEDIASUBTYPE_I420)) + { + pBIH->biWidth = FFALIGN(width, 2); + } HRESULT hrQA = m_pOutput->GetConnected()->QueryAccept(&mt); if (bDXVA) @@ -1630,6 +1634,7 @@ HRESULT CLAVVideo::ReconnectOutput(int width, int height, AVRational ar, DXVA2_E else { DbgLog((LOG_TRACE, 10, L"-> Receive Connection failed (hr: %x); QueryAccept: %x", hr, hrQA)); + return E_FAIL; } } if (bNeedReconnect && !bDXVA)