Skip to content

Commit

Permalink
#3703 use correct exception type for invalid data
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Aug 15, 2023
1 parent 27ad5ad commit cc37b9d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions xpra/codecs/nvidia/nvdec/decoder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ ctypedef void *CUvideoparser
ctypedef long long CUvideotimestamp


DEF CUDA_ERROR_INVALID_IMAGE = 200

ctypedef struct rect:
short left
short top
Expand Down Expand Up @@ -685,6 +687,8 @@ cdef class Decoder:
pic.pBitstreamData = <const unsigned char*> (<uintptr_t> int(self.buffer))
with nogil:
r = cuvidDecodePicture(self.context, pic)
if r==CUDA_ERROR_INVALID_IMAGE:
raise ValueError("invalid image data")
log(f"cuvidDecodePicture()={r}")
cudacheck(r, "GPU picture decoding returned error")
cdef CUVIDGETDECODESTATUS status
Expand Down

0 comments on commit cc37b9d

Please sign in to comment.