winrt: Fix Lumia 1520 black viewfinder.

The latest Denim update broke VideoProcessorBlt for Lumia 1520. After
the update, the blit results in a black target texture. As a
workaround, don't use DirectVideo, but leave format conversion and
drawing to the EGL Node.

Task-Id: QTBUG-48331
Change-Id: I1dab6b58d52d0e24fbffb91f23772906a576047a
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
This commit is contained in:
Samuel Nevala
2015-09-25 14:54:30 +03:00
parent 572f3f80fc
commit f6082d4632

View File

@@ -44,10 +44,27 @@
#include <d3d11.h>
#include <mfapi.h>
#include <wrl.h>
#ifdef Q_OS_WINPHONE
#include <Windows.Security.ExchangeActiveSyncProvisioning.h>
using namespace ABI::Windows::Security::ExchangeActiveSyncProvisioning;
#endif
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
QT_BEGIN_NAMESPACE
#ifdef Q_OS_WINPHONE
template <int n>
static bool blacklisted(const wchar_t (&blackListName)[n], const HString &deviceModel)
{
quint32 deviceNameLength;
const wchar_t *deviceName = deviceModel.GetRawBuffer(&deviceNameLength);
return n - 1 <= deviceNameLength && !wmemcmp(blackListName, deviceName, n - 1);
}
#endif
class QWinRTCameraVideoBuffer : public QAbstractVideoBuffer
{
public:
@@ -255,6 +272,19 @@ QWinRTCameraVideoRendererControl::QWinRTCameraVideoRendererControl(const QSize &
Q_D(QWinRTCameraVideoRendererControl);
d->cameraSampleformat = QVideoFrame::Format_User;
d->videoProbesCounter = 0;
#ifdef Q_OS_WINPHONE
// Workaround for certain devices which fail to blit.
ComPtr<IEasClientDeviceInformation> deviceInfo;
HRESULT hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Security_ExchangeActiveSyncProvisioning_EasClientDeviceInformation).Get(),
&deviceInfo);
Q_ASSERT_SUCCEEDED(hr);
HString deviceModel;
hr = deviceInfo->get_SystemProductName(deviceModel.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
// Blacklist Lumia 1520
setBlitMode(blacklisted(L"RM-937", deviceModel) ? MediaFoundation : DirectVideo);
#endif
}
QWinRTCameraVideoRendererControl::~QWinRTCameraVideoRendererControl()