v4l2codecs: Fix renegotiation

If we hold the last reference to the allocator, leaving the device
streaming will cause an EBUSY error when trying to free the allocate
buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1404>
This commit is contained in:
Nicolas Dufresne 2021-12-01 09:51:57 -05:00
parent e87791592e
commit a6eb1e7782
4 changed files with 8 additions and 13 deletions

View file

@ -322,11 +322,11 @@ gst_v4l2_codec_h264_dec_negotiate (GstVideoDecoder * decoder)
GST_DEBUG_OBJECT (self, "Negotiate");
gst_v4l2_codec_h264_dec_reset_allocation (self);
gst_v4l2_decoder_streamoff (self->decoder, GST_PAD_SINK);
gst_v4l2_decoder_streamoff (self->decoder, GST_PAD_SRC);
gst_v4l2_codec_h264_dec_reset_allocation (self);
if (!gst_v4l2_decoder_set_sink_fmt (self->decoder, V4L2_PIX_FMT_H264_SLICE,
self->coded_width, self->coded_height, get_pixel_bitdepth (self))) {
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,

View file

@ -241,11 +241,11 @@ gst_v4l2_codec_mpeg2_dec_negotiate (GstVideoDecoder * decoder)
GST_DEBUG_OBJECT (self, "Negotiate");
gst_v4l2_codec_mpeg2_dec_reset_allocation (self);
gst_v4l2_decoder_streamoff (self->decoder, GST_PAD_SINK);
gst_v4l2_decoder_streamoff (self->decoder, GST_PAD_SRC);
gst_v4l2_codec_mpeg2_dec_reset_allocation (self);
if (!gst_v4l2_decoder_set_sink_fmt (self->decoder, V4L2_PIX_FMT_MPEG2_SLICE,
self->width, self->height, get_pixel_bitdepth (self))) {
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,

View file

@ -191,11 +191,11 @@ gst_v4l2_codec_vp8_dec_negotiate (GstVideoDecoder * decoder)
GST_DEBUG_OBJECT (self, "Negotiate");
gst_v4l2_codec_vp8_dec_reset_allocation (self);
gst_v4l2_decoder_streamoff (self->decoder, GST_PAD_SINK);
gst_v4l2_decoder_streamoff (self->decoder, GST_PAD_SRC);
gst_v4l2_codec_vp8_dec_reset_allocation (self);
if (!gst_v4l2_decoder_set_sink_fmt (self->decoder, V4L2_PIX_FMT_VP8_FRAME,
self->width, self->height, 12 /* 8 bits 4:2:0 */ )) {
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,

View file

@ -429,11 +429,11 @@ gst_v4l2_codec_vp9_dec_negotiate (GstVideoDecoder * decoder)
GST_DEBUG_OBJECT (self, "Negotiate");
gst_v4l2_codec_vp9_dec_reset_allocation (self);
gst_v4l2_decoder_streamoff (self->decoder, GST_PAD_SINK);
gst_v4l2_decoder_streamoff (self->decoder, GST_PAD_SRC);
gst_v4l2_codec_vp9_dec_reset_allocation (self);
if (!gst_v4l2_decoder_set_sink_fmt (self->decoder, V4L2_PIX_FMT_VP9_FRAME,
self->width, self->height, self->bit_depth)) {
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
@ -562,11 +562,6 @@ gst_v4l2_codec_vp9_dec_new_sequence (GstVp9Decoder * decoder,
/* TODO Check if current buffers are large enough, and reuse them */
if (self->width != frame_hdr->width || self->height != frame_hdr->height) {
if (self->width > 0 || self->height > 0) {
GST_ERROR_OBJECT (self,
"Dynamic resolution changes are not yet supported in v4l2");
return GST_FLOW_ERROR;
}
self->width = frame_hdr->width;
self->height = frame_hdr->height;
negotiation_needed = TRUE;