Decode_Status VaapiDecoderVP9::decode(const Vp9FrameHdr* hdr, const uint8_t* data, uint32_t size, uint64_t timeStamp) { Decode_Status ret; ret = ensureContext(hdr); if (ret != DECODE_SUCCESS) return ret; PicturePtr picture = createPicture(timeStamp); if (!picture) return DECODE_MEMORY_FAIL; if (!picture->getSurface()->resize(hdr->width, hdr->height)) { ERROR("resize to %dx%d failed", hdr->width, hdr->height); return DECODE_MEMORY_FAIL; } if (hdr->show_existing_frame) { SurfacePtr& surface = m_reference[hdr->frame_to_show]; if (!surface) { ERROR("frame to show is invalid, idx = %d", hdr->frame_to_show); return DECODE_SUCCESS; } picture->setSurface(surface); return outputPicture(picture); } if (!ensurePicture(picture, hdr)) return DECODE_FAIL; if (!ensureSlice(picture, data, size)) return DECODE_FAIL; ret = picture->decode(); if (ret != DECODE_SUCCESS) return ret; updateReference(picture, hdr); if (hdr->show_frame) return outputPicture(picture); return DECODE_SUCCESS; }