mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-03 15:06:34 +00:00
msdk:dec: Add new propery to dump frames in decoded order
The new property "output-order" can be set to either "display" order which is the default where frames will be outputting in display order, or "decoded-order" which will be outputting the frames in decoded order. The "decoded order" output is generally useful for debugging. But there are few customers who use it for low-latency streaming. For eg if the customer already knows that the stream doesn't have b-frames (which means no algorithm requires for display order calculation), then they can use "decoded-order" output to skip some of the DPB logic to avoid the frame accumulation at start-up. The root cause of the above issue is a bit of unclarity in h264 spec + lazy implementation of many H264 encoders; This is well handled in gstreamer-vaapi using "low-latency" property: https://bugzilla.gnome.org/show_bug.cgi?id=762509 https://bugzilla.gnome.org/show_bug.cgi?id=795783
This commit is contained in:
parent
a372c05f06
commit
54482a54d8
4 changed files with 52 additions and 0 deletions
|
@ -40,6 +40,7 @@
|
|||
#include "gstmsdkvideomemory.h"
|
||||
#include "gstmsdksystemmemory.h"
|
||||
#include "gstmsdkcontextutil.h"
|
||||
#include "msdk-enums.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkdec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkdec_debug
|
||||
|
@ -61,10 +62,12 @@ enum
|
|||
PROP_0,
|
||||
PROP_HARDWARE,
|
||||
PROP_ASYNC_DEPTH,
|
||||
PROP_OUTPUT_ORDER,
|
||||
};
|
||||
|
||||
#define PROP_HARDWARE_DEFAULT TRUE
|
||||
#define PROP_ASYNC_DEPTH_DEFAULT 1
|
||||
#define PROP_OUTPUT_ORDER_DEFAULT GST_MSDKDEC_OUTPUT_ORDER_DISPLAY
|
||||
|
||||
#define gst_msdkdec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMsdkDec, gst_msdkdec, GST_TYPE_VIDEO_DECODER);
|
||||
|
@ -272,6 +275,10 @@ gst_msdkdec_init_decoder (GstMsdkDec * thiz)
|
|||
thiz->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
|
||||
thiz->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
|
||||
|
||||
/* This is a deprecated attribute in msdk-2017 version, but some
|
||||
* customers still using this for low-latency streaming of non-b-frame
|
||||
* encoded streams */
|
||||
thiz->param.mfx.DecodedOrder = thiz->output_order;
|
||||
/* allow subclass configure further */
|
||||
if (klass->configure) {
|
||||
if (!klass->configure (thiz))
|
||||
|
@ -1060,6 +1067,9 @@ gst_msdkdec_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
case PROP_ASYNC_DEPTH:
|
||||
thiz->async_depth = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_OUTPUT_ORDER:
|
||||
thiz->output_order = g_value_get_enum (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -1089,6 +1099,9 @@ gst_msdkdec_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
case PROP_ASYNC_DEPTH:
|
||||
g_value_set_uint (value, thiz->async_depth);
|
||||
break;
|
||||
case PROP_OUTPUT_ORDER:
|
||||
g_value_set_enum (value, thiz->output_order);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -1144,6 +1157,13 @@ gst_msdkdec_class_init (GstMsdkDecClass * klass)
|
|||
1, 20, PROP_ASYNC_DEPTH_DEFAULT,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_OUTPUT_ORDER,
|
||||
g_param_spec_enum ("output-order", "DecodedFramesOutputOrder",
|
||||
"Decoded frames output order",
|
||||
gst_msdkdec_output_order_get_type (),
|
||||
PROP_OUTPUT_ORDER_DEFAULT,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
}
|
||||
|
||||
|
@ -1156,6 +1176,7 @@ gst_msdkdec_init (GstMsdkDec * thiz)
|
|||
thiz->tasks = g_array_new (FALSE, TRUE, sizeof (MsdkDecTask));
|
||||
thiz->hardware = PROP_HARDWARE_DEFAULT;
|
||||
thiz->async_depth = PROP_ASYNC_DEPTH_DEFAULT;
|
||||
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
|
||||
thiz->is_packetized = TRUE;
|
||||
thiz->adapter = gst_adapter_new ();
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ struct _GstMsdkDec
|
|||
/* element properties */
|
||||
gboolean hardware;
|
||||
guint async_depth;
|
||||
guint output_order;
|
||||
};
|
||||
|
||||
struct _GstMsdkDecClass
|
||||
|
|
|
@ -33,6 +33,26 @@
|
|||
|
||||
#include "msdk-enums.h"
|
||||
|
||||
/*========= MSDK Decoder Enums =========================*/
|
||||
GType
|
||||
gst_msdkdec_output_order_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
static const GEnumValue values[] = {
|
||||
{GST_MSDKDEC_OUTPUT_ORDER_DISPLAY, "Output frames in Display order",
|
||||
"display"},
|
||||
{GST_MSDKDEC_OUTPUT_ORDER_DECODE, "Output frames in Decoded order",
|
||||
"decoded"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (!type) {
|
||||
type = g_enum_register_static ("GstMsdkDecOutputOrder", values);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/*========= MSDK Encoder Enums =========================*/
|
||||
GType
|
||||
gst_msdkenc_rate_control_get_type (void)
|
||||
|
|
|
@ -40,6 +40,16 @@ G_BEGIN_DECLS
|
|||
|
||||
#define _MFX_TRELLIS_NONE 0
|
||||
|
||||
/*========= MSDK Decoder Enums =========================*/
|
||||
typedef enum
|
||||
{
|
||||
GST_MSDKDEC_OUTPUT_ORDER_DISPLAY = 0,
|
||||
GST_MSDKDEC_OUTPUT_ORDER_DECODE,
|
||||
} GstMskdDecOutputOrder;
|
||||
|
||||
GType
|
||||
gst_msdkdec_output_order_get_type (void);
|
||||
|
||||
/*========= MSDK Encoder Enums =========================*/
|
||||
GType
|
||||
gst_msdkenc_rate_control_get_type (void);
|
||||
|
|
Loading…
Reference in a new issue