Skip to content

Commit 69b6bd7

Browse files
authored
fix isValid() for VAAPI frame (#141)
* fix for AVAPI frame format * valid values for VASurfaceID is > 0
1 parent 5e167a4 commit 69b6bd7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/frame.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,12 @@ class Frame : public FFWrapperPtr<AVFrame>
264264

265265
bool isComplete() const { return m_isComplete; }
266266

267-
bool isValid() const { return (!isNull() && m_raw->data[0] && m_raw->linesize[0]); }
267+
bool isValid() const {
268+
return (!isNull() &&
269+
((m_raw->data[0] && m_raw->linesize[0]) ||
270+
((m_raw->format == AV_PIX_FMT_VAAPI) && ((intptr_t)m_raw->data[3] > 0)))
271+
);
272+
}
268273

269274
operator bool() const { return isValid() && isComplete(); }
270275

0 commit comments

Comments
 (0)