Skip to content

Commit

Permalink
avoid asserts in cython code, especially when it can fire during clea…
Browse files Browse the repository at this point in the history
…nup logging!

git-svn-id: https://xpra.org/svn/Xpra/trunk@7199 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 8, 2014
1 parent 52acd77 commit bf793fe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/xpra/codecs/dec_avcodec2/decoder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ def get_encodings():
return CODECS

def get_input_colorspaces(encoding):
assert encoding in CODECS
if encoding not in CODECS:
return []
if encoding in ("h264", "h265"):
return COLORSPACES
elif encoding=="vp8":
Expand All @@ -183,7 +184,8 @@ def get_input_colorspaces(encoding):
return ["YUV420P", "YUV422P", "YUV444P"]

def get_output_colorspace(encoding, csc):
assert encoding in CODECS
if encoding not in CODECS:
return ""
if encoding=="h264" and csc in ("RGB", "XRGB", "BGRX", "ARGB", "BGRA"):
#h264 from plain RGB data is returned as "GBRP"!
return "GBRP"
Expand Down Expand Up @@ -424,6 +426,8 @@ cdef class Decoder:
return str(errnum)

def __repr__(self): #@DuplicatedSignature
if self.is_closed():
return "dec_avcodec.Decoder(*closed*)"
return "dec_avcodec.Decoder(%s)" % self.get_info()

def get_info(self): #@DuplicatedSignature
Expand Down

0 comments on commit bf793fe

Please sign in to comment.