Skip to content

codecs: h264decoder: Make GstVideoCodecFrame hold the last reference of the buffer

... when gst_video_decoder_finish_frame() is called.

Some subclasses attach GstBuffer to GstH264Picture as an user data
which will increase reference count of the buffer. It would result
to buffer copy per every frame.

Background here is, GstVideoDecoder wants writable output buffer for
GstMeta handling, and if the output buffer is not writable
(i.e., reference count is not one), the buffer will be copied.
Even if underlying GstMemory wouldn't be copied, buffer copy operation
will introduce extra memory allocation overhead which is not optimal.

By this modification, subclass might be able to receive the last
reference to GstH264Picture
codecs: h264decoder: Pass GstVideoCodecFrame to output_picture()

All subclasses are retrieving list to get target output frame, which
can be done by baseclass. And pass the ownership of the GstH264Picture
to subclass so that subclass can clear implementation dependent resources
before finishing the frame.
codecs: h264decoder: Don't attach extra ref of GstH264Picture to GstVideoCodecFrame

The lifecycle of GstH264Picture is being managed by our DPB
implementation. If it's still required, subclass can do that
by itself in the new_picture() method.

cc @ndufresne @vjaquez

  • d3d11h264dec
  • nvh264sldec
  • vah264dec
  • v4l2
Edited by GStreamer Release Monkey

Merge request reports