va: basedec: copy frames logic to decide_allocation()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1673>
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-10-09 16:00:18 +02:00 committed by GStreamer Merge Bot
parent 5658c4182a
commit 18444fd993
4 changed files with 17 additions and 27 deletions

View file

@ -323,6 +323,15 @@ gst_va_base_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
else
gst_query_add_allocation_pool (query, pool, size, min, max);
if (!base->has_videometa) {
if ((base->copy_frames = gst_va_pool_requires_video_meta (pool))) {
GST_INFO_OBJECT (base, "Raw frame copy enabled.");
_create_other_pool (base, other_allocator, &other_params, caps, size);
}
}
if (!base->copy_frames)
gst_clear_object (&base->other_pool);
gst_object_unref (allocator);
gst_object_unref (pool);

View file

@ -65,6 +65,8 @@ struct _GstVaBaseDec
GstVideoAlignment valign;
gboolean has_videometa;
gboolean copy_frames;
};
struct _GstVaBaseDecClass

View file

@ -52,7 +52,6 @@
#include "gstvah264dec.h"
#include "gstvabasedec.h"
#include "gstvapool.h"
GST_DEBUG_CATEGORY_STATIC (gst_va_h264dec_debug);
#ifndef GST_DISABLE_GST_DEBUG
@ -84,7 +83,6 @@ struct _GstVaH264Dec
gint dpb_size;
gboolean need_negotiation;
gboolean copy_frames;
};
#define parent_class gst_va_base_dec_parent_class
@ -115,6 +113,7 @@ static GstFlowReturn
gst_va_h264_dec_output_picture (GstH264Decoder * decoder,
GstVideoCodecFrame * frame, GstH264Picture * picture)
{
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVaH264Dec *self = GST_VA_H264_DEC (decoder);
GST_LOG_OBJECT (self,
@ -126,8 +125,8 @@ gst_va_h264_dec_output_picture (GstH264Decoder * decoder,
return self->last_ret;
}
if (self->copy_frames)
gst_va_base_dec_copy_output_buffer (GST_VA_BASE_DEC (self), frame);
if (base->copy_frames)
gst_va_base_dec_copy_output_buffer (base, frame);
gst_h264_picture_unref (picture);
@ -668,17 +667,6 @@ gst_va_h264_dec_new_sequence (GstH264Decoder * decoder, const GstH264SPS * sps,
}
}
if (!base->has_videometa) {
GstBufferPool *pool;
pool = gst_video_decoder_get_buffer_pool (GST_VIDEO_DECODER (self));
self->copy_frames = gst_va_pool_requires_video_meta (pool);
gst_object_unref (pool);
if (self->copy_frames)
GST_INFO_OBJECT (self, "Raw frame copy enabled.");
}
return TRUE;
}

View file

@ -46,7 +46,6 @@
#include "gstvavp8dec.h"
#include "gstvabasedec.h"
#include "gstvapool.h"
GST_DEBUG_CATEGORY_STATIC (gst_va_vp8dec_debug);
#ifndef GST_DISABLE_GST_DEBUG
@ -74,7 +73,6 @@ struct _GstVaVp8Dec
GstFlowReturn last_ret;
gboolean need_negotiation;
gboolean copy_frames;
};
#define parent_class gst_va_base_dec_parent_class
@ -189,14 +187,6 @@ gst_va_vp8_dec_new_sequence (GstVp8Decoder * decoder,
}
}
if (!base->has_videometa) {
GstBufferPool *pool;
pool = gst_video_decoder_get_buffer_pool (GST_VIDEO_DECODER (self));
self->copy_frames = gst_va_pool_requires_video_meta (pool);
gst_object_unref (pool);
}
return TRUE;
}
@ -460,6 +450,7 @@ static GstFlowReturn
gst_va_vp8_dec_output_picture (GstVp8Decoder * decoder,
GstVideoCodecFrame * frame, GstVp8Picture * picture)
{
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVaVp8Dec *self = GST_VA_VP8_DEC (decoder);
GST_LOG_OBJECT (self,
@ -472,8 +463,8 @@ gst_va_vp8_dec_output_picture (GstVp8Decoder * decoder,
return self->last_ret;
}
if (self->copy_frames)
gst_va_base_dec_copy_output_buffer (GST_VA_BASE_DEC (self), frame);
if (base->copy_frames)
gst_va_base_dec_copy_output_buffer (base, frame);
gst_vp8_picture_unref (picture);