void VaapiDecSurfacePool::flush()
{
    AutoLock lock(m_lock);
    for (OutputQueue::iterator it = m_output.begin();
        it != m_output.end(); ++it) {
        recycleLocked((*it)->surface, SURFACE_TO_RENDER);
    }
    m_output.clear();
    //still have unreleased surface
    if (!m_allocated.empty())
        m_flushing = true;
}
/**
 * Return value indicates whether resource was actually recycled, which happens when RefCnt
 * reaches 0.
 */
bool ResourceCache::recycle(SkBitmap* resource) {
    Mutex::Autolock _l(mLock);
    return recycleLocked(resource);
}
void VaapiDecSurfacePool::recycle(VASurfaceID id, SurfaceState flag)
{
    AutoLock lock(m_lock);
    recycleLocked(id,flag);
}