Skip to content

Commit

Permalink
Fix segfault when calling subtitle_stream.decode()
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Jul 17, 2024
1 parent a6627f8 commit 53bb5ca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions av/subtitles/codeccontext.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ from av.subtitles.subtitle cimport SubtitleProxy, SubtitleSet

cdef class SubtitleCodecContext(CodecContext):
cdef _send_packet_and_recv(self, Packet packet):
if packet is None:
raise RuntimeError("packet cannot be None")

cdef SubtitleProxy proxy = SubtitleProxy()
cdef int got_frame = 0

err_check(
lib.avcodec_decode_subtitle2(
self.ptr, &proxy.struct, &got_frame, packet.ptr if packet else NULL
)
lib.avcodec_decode_subtitle2(self.ptr, &proxy.struct, &got_frame, packet.ptr)
)

if got_frame:
Expand Down

0 comments on commit 53bb5ca

Please sign in to comment.