Giter Club home page Giter Club logo

Comments (2)

cgutman avatar cgutman commented on May 24, 2024

I need your full Moonlight log file to investigate.

from moonlight-qt.

fogin avatar fogin commented on May 24, 2024

I used the dxva2.cpp file alone as part of my renderer, and the error disappeared after I added the following code to the end of the initialize function:
{
m_HwDeviceContext = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_DXVA2);
if (!m_HwDeviceContext) {
ALOGE("Failed to allocate D3D11VA device context");
return false;
}

    AVHWDeviceContext* deviceContext = (AVHWDeviceContext*)m_HwDeviceContext->data;
    AVDXVA2DeviceContext* dxva2DevCtx = (AVDXVA2DeviceContext*)deviceContext->hwctx;

    // AVHWDeviceContext takes ownership of these objects
    UINT reset_token = 0;
    HRESULT hr = DXVA2CreateDirect3DDeviceManager9(&reset_token, &dxva2DevCtx->devmgr);
    if (FAILED(hr))
        return false;

    hr = dxva2DevCtx->devmgr->ResetDevice(m_Device, reset_token);
    if (FAILED(hr))
        return false;

    int err = av_hwdevice_ctx_init(m_HwDeviceContext);
    if (err < 0) {
        ALOGE("Failed to initialize D3D11VA device context: %d",
            err);
        return false;
    }
}

{
    m_HwFramesContext = av_hwframe_ctx_alloc(m_HwDeviceContext);
    if (!m_HwFramesContext) {
        ALOGE("Failed to allocate D3D11VA frame context");
        return false;
    }

    AVHWFramesContext* framesContext = (AVHWFramesContext*)m_HwFramesContext->data;

    // We require NV12 or P010 textures for our shader
    framesContext->format = AV_PIX_FMT_DXVA2_VLD;
    framesContext->sw_format = AV_PIX_FMT_NV12;

    framesContext->width = FFALIGN(params->width, 128);
    framesContext->height = FFALIGN(params->height, 128);
    /* 1 base work surface */
    int num_surfaces = 20;

    /* add surfaces based on number of possible refs */
    framesContext->initial_pool_size = num_surfaces;
    int err = av_hwframe_ctx_init(m_HwFramesContext);
    if (err < 0) {
        ALOGE("Failed to initialize D3D11VA frame context: %d", err);
        return false;
    }
}

from moonlight-qt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.