Skip to content

Commit b9d99f0

Browse files
committed
VideoFrame: Don't need np_buffer
1 parent 5a65cd3 commit b9d99f0

File tree

3 files changed

+1
-8
lines changed

3 files changed

+1
-8
lines changed

av/video/frame.pxd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ cdef class VideoFrame(Frame):
2323
# This is the buffer that is used to back everything in the AVFrame.
2424
# We don't ever actually access it directly.
2525
cdef uint8_t *_buffer
26-
cdef object _np_buffer
2726
cdef object _cuda_ctx
2827

2928
cdef VideoReformatter reformatter

av/video/frame.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,7 @@ def _init_user_attributes(self):
403403
)
404404

405405
def __dealloc__(self):
406-
# The `self._buffer` member is only set if *we* allocated the buffer in `_init`,
407-
# as opposed to a buffer allocated by a decoder.
408406
lib.av_frame_unref(self.ptr)
409-
# Let go of the reference from the numpy buffers if we made one
410-
self._np_buffer = None
411407

412408
def __repr__(self):
413409
return (
@@ -1061,7 +1057,6 @@ def _image_fill_pointers_numpy(self, buffer, width, height, linesizes, format):
10611057
c_ptr: cython.pointer[uint8_t] = cython.cast(cython.pointer[uint8_t], c_data)
10621058
c_format: lib.AVPixelFormat = get_pix_fmt(format)
10631059
lib.av_frame_unref(self.ptr)
1064-
self._np_buffer = None
10651060

10661061
# Hold on to a reference for the numpy buffer so that it doesn't get accidentally garbage collected
10671062
self.ptr.format = c_format
@@ -1094,7 +1089,6 @@ def _image_fill_pointers_numpy(self, buffer, width, height, linesizes, format):
10941089
Py_DECREF(py_buf)
10951090
raise MemoryError("av_buffer_create failed")
10961091

1097-
self._np_buffer = buffer
10981092
self._init_user_attributes()
10991093

11001094
@staticmethod

av/video/frame.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ class VideoFrame(Frame):
101101
device_id: int | None = None,
102102
primary_ctx: bool = True,
103103
cuda_context: CudaContext | None = None,
104-
) -> "VideoFrame": ...
104+
) -> VideoFrame: ...

0 commit comments

Comments
 (0)