mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
v4l2codecs: gstv4l2codecsvp8dec: implement a render delay
The v4l2 backend support delayed output for performance reasons. It is then possible to use render delays to queue multiple requests simultaneously, thus increasing performance. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2150>
This commit is contained in:
parent
82c0005793
commit
89bc464360
1 changed files with 25 additions and 1 deletions
|
@ -82,6 +82,24 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstV4l2CodecVp8Dec,
|
||||||
"V4L2 stateless VP8 decoder"));
|
"V4L2 stateless VP8 decoder"));
|
||||||
#define parent_class gst_v4l2_codec_vp8_dec_parent_class
|
#define parent_class gst_v4l2_codec_vp8_dec_parent_class
|
||||||
|
|
||||||
|
static guint
|
||||||
|
gst_v4l2_codec_vp8_dec_get_preferred_output_delay (GstVp8Decoder * decoder,
|
||||||
|
gboolean is_live)
|
||||||
|
{
|
||||||
|
|
||||||
|
GstV4l2CodecVp8Dec *self = GST_V4L2_CODEC_VP8_DEC (decoder);
|
||||||
|
guint delay;
|
||||||
|
|
||||||
|
if (is_live)
|
||||||
|
delay = 0;
|
||||||
|
else
|
||||||
|
/* Just one for now, perhaps we can make this configurable in the future. */
|
||||||
|
delay = 1;
|
||||||
|
|
||||||
|
gst_v4l2_decoder_set_render_delay (self->decoder, delay);
|
||||||
|
return delay;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_v4l2_codec_vp8_dec_open (GstVideoDecoder * decoder)
|
gst_v4l2_codec_vp8_dec_open (GstVideoDecoder * decoder)
|
||||||
{
|
{
|
||||||
|
@ -240,6 +258,7 @@ gst_v4l2_codec_vp8_dec_decide_allocation (GstVideoDecoder * decoder,
|
||||||
{
|
{
|
||||||
GstV4l2CodecVp8Dec *self = GST_V4L2_CODEC_VP8_DEC (decoder);
|
GstV4l2CodecVp8Dec *self = GST_V4L2_CODEC_VP8_DEC (decoder);
|
||||||
guint min = 0;
|
guint min = 0;
|
||||||
|
guint num_bitstream;
|
||||||
|
|
||||||
self->has_videometa = gst_query_find_allocation_meta (query,
|
self->has_videometa = gst_query_find_allocation_meta (query,
|
||||||
GST_VIDEO_META_API_TYPE, NULL);
|
GST_VIDEO_META_API_TYPE, NULL);
|
||||||
|
@ -252,8 +271,11 @@ gst_v4l2_codec_vp8_dec_decide_allocation (GstVideoDecoder * decoder,
|
||||||
|
|
||||||
min = MAX (2, min);
|
min = MAX (2, min);
|
||||||
|
|
||||||
|
num_bitstream = 1 +
|
||||||
|
MAX (1, gst_v4l2_decoder_get_render_delay (self->decoder));
|
||||||
|
|
||||||
self->sink_allocator = gst_v4l2_codec_allocator_new (self->decoder,
|
self->sink_allocator = gst_v4l2_codec_allocator_new (self->decoder,
|
||||||
GST_PAD_SINK, 2);
|
GST_PAD_SINK, num_bitstream);
|
||||||
self->src_allocator = gst_v4l2_codec_allocator_new (self->decoder,
|
self->src_allocator = gst_v4l2_codec_allocator_new (self->decoder,
|
||||||
GST_PAD_SRC, self->min_pool_size + min + 4);
|
GST_PAD_SRC, self->min_pool_size + min + 4);
|
||||||
self->src_pool = gst_v4l2_codec_pool_new (self->src_allocator, &self->vinfo);
|
self->src_pool = gst_v4l2_codec_pool_new (self->src_allocator, &self->vinfo);
|
||||||
|
@ -850,6 +872,8 @@ gst_v4l2_codec_vp8_dec_subclass_init (GstV4l2CodecVp8DecClass * klass,
|
||||||
GST_DEBUG_FUNCPTR (gst_v4l2_codec_vp8_dec_end_picture);
|
GST_DEBUG_FUNCPTR (gst_v4l2_codec_vp8_dec_end_picture);
|
||||||
vp8decoder_class->output_picture =
|
vp8decoder_class->output_picture =
|
||||||
GST_DEBUG_FUNCPTR (gst_v4l2_codec_vp8_dec_output_picture);
|
GST_DEBUG_FUNCPTR (gst_v4l2_codec_vp8_dec_output_picture);
|
||||||
|
vp8decoder_class->get_preferred_output_delay =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_v4l2_codec_vp8_dec_get_preferred_output_delay);
|
||||||
|
|
||||||
klass->device = device;
|
klass->device = device;
|
||||||
gst_v4l2_decoder_install_properties (gobject_class, PROP_LAST, device);
|
gst_v4l2_decoder_install_properties (gobject_class, PROP_LAST, device);
|
||||||
|
|
Loading…
Reference in a new issue