示例#1
0
SurfacePtr VaapiDecSurfacePool::acquireWithWait()
{
    SurfacePtr surface;
    AutoLock lock(m_lock);
    if (m_flushing) {
        ERROR("uppper layer bug, only support flush in decode thread");
        return surface;
    }
    while (m_freed.empty())
        m_cond.wait();

    if (m_flushing) {
        ERROR("uppper layer bug, only support flush in decode thread");
        return surface;
    }

    assert(!m_freed.empty());
    VASurfaceID id = m_freed.front();
    m_freed.pop_front();
    m_allocated[id] = SURFACE_DECODING;
    VaapiSurface* s = m_surfaceMap[id];
    surface.reset(s, SurfaceRecycler(shared_from_this()));
    return surface;
}
示例#2
0
SurfacePtr VaapiEncoderBase::createSurface(const SharedPtr<VideoFrame>& frame)
{
    SurfacePtr surface(new VaapiSurface(m_display, (VASurfaceID)frame->surface), SurfaceRecycler(frame));
    return surface;
}