Skip to content

Commit

Permalink
fix isValid() for VAAPI frame (#141)
Browse files Browse the repository at this point in the history
* fix for AVAPI frame format
* valid values for VASurfaceID is > 0
  • Loading branch information
lukasz-misek authored Nov 13, 2024
1 parent 5e167a4 commit 69b6bd7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ class Frame : public FFWrapperPtr<AVFrame>

bool isComplete() const { return m_isComplete; }

bool isValid() const { return (!isNull() && m_raw->data[0] && m_raw->linesize[0]); }
bool isValid() const {
return (!isNull() &&
((m_raw->data[0] && m_raw->linesize[0]) ||
((m_raw->format == AV_PIX_FMT_VAAPI) && ((intptr_t)m_raw->data[3] > 0)))
);
}

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

Expand Down

0 comments on commit 69b6bd7

Please sign in to comment.