test env
deepstream-app version 6.1.1
DeepStreamSDK 6.1.1
CUDA Driver Version: 12.0
CUDA Runtime Version: 11.7
TensorRT Version: 8.4
cuDNN Version: 8.5
libNVWarp360 Version: 2.0.1d3
what i want to do
i need input network image to my pipeline, so use appsrc to read data by imencode, in my test pipeline, i use cv::imread/imencode to mock network data input. but pipeline run crash.
test code
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappsink.h>
#include <vector>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <cstdio>
#include <string>
#include <map>
#include <opencv2/imgcodecs.hpp>
#define DEFAULT_IMAGE_WIDTH 480
#define DEFAULT_IMAGE_HEIGHT 640
#define DEFAULT_FRAME_SIZE (3 * DEFAULT_IMAGE_WIDTH * DEFAULT_IMAGE_HEIGHT)
#define DEFAULT_MAX_FRAMES (10 * DEFAULT_FRAME_SIZE)
#define USE_TIME_FORMAT 0
#define USE_CUSTOM_PTS 1
#define DEFAULT_FPS 25
/* Muxer batch formation timeout, for e.g. 40 millisec. Should ideally be set
* based on the fastest source's framerate. */
#define MUXER_BATCH_TIMEOUT_USEC 33000
/* Structure to contain all our information for appsrc,
* so we can pass it to callbacks */
typedef struct _CustomData {
GstElement *app_source;
guint fps; /* To set the FPS value */
guint source_id; /* To control the GSource */
gint frame_num;
} CustomData;
std::map<std::string, std::string> image_files;
static CustomData app_src_data = {NULL, DEFAULT_FPS, 0, 0};
GstElement *pipeline = NULL;
/* new_sample is an appsink callback that will extract metadata received
* tee sink pad and update params for drawing rectangle,
*object information etc. */
static GstFlowReturn
new_sample(GstElement *sink, gpointer *data) {
static gint frame_number = 0;
guint num_frame = 0;
guint num_body = 0;
guint num_face = 0;
unsigned long int pts = 0;
g_print(">>> new_sample coming %d.\n", frame_number);
if (gst_app_sink_is_eos(GST_APP_SINK(sink))) {
g_print("EOS received in Appsink********\n");
}
GstSample *sample = gst_app_sink_pull_sample(GST_APP_SINK(sink));
if (!sample) {
g_printerr("gst_app_sink_pull_sample failed.\n");
return GST_FLOW_ERROR;
}
gst_sample_unref(sample);
g_print("<<< Frame Number = %d (%d) Number of body = %d Number of face = %d PTS = %" GST_TIME_FORMAT "\n",
frame_number, num_frame, num_body, num_face, GST_TIME_ARGS (pts));
frame_number++;
return GST_FLOW_OK;
}
/* This method is called by the idle GSource in the mainloop,
* to feed one raw video frame into appsrc.
* The idle handler is added to the mainloop when appsrc requests us
* to start sending data (need-data signal)
* and is removed when appsrc has enough data (enough-data signal).
*
* return False, will remove read_data callback in idle-loop
*/
static gboolean
read_data(CustomData *data) {
static u_int64_t idl_idx = 0;
static auto read_iter = image_files.begin();
GstMapInfo map;
GstBuffer *buffer = gst_buffer_new_allocate(NULL, DEFAULT_FRAME_SIZE, NULL);
if (!gst_buffer_map(buffer, &map, GST_MAP_WRITE)) {
printf("Unable to map info from buffer");
return false;
}
if (read_iter != image_files.end()) {
int fd = open(read_iter->second.c_str(), O_RDWR);
if (fd != -1) {
size_t ret = 0;
#if 1
{
cv::Mat img = cv::imread(read_iter->second.c_str());
std::vector<int> param = std::vector<int>(2);
param[0] = cv::IMWRITE_JPEG_QUALITY;
param[1] = 100;
std::vector<uchar> data_encode;
imencode(".jpeg", img, data_encode, param);
memset (map.data, 0, data_encode.size());
map.size = data_encode.size();
memcpy(map.data, &data_encode[0], data_encode.size() * sizeof(uchar));
}
#else
{
ret = read(fd, map.data, DEFAULT_FRAME_SIZE);
}
#endif
ret = map.size;
gst_buffer_unmap(buffer, &map);
if (ret > 0) {
GstFlowReturn gstret = gst_app_src_push_buffer((GstAppSrc *) data->app_source, buffer);
if (gstret == GST_FLOW_OK) {
g_print("gst_app_src_push_buffer success, %d.\n", data->frame_num);
} else {
g_print("gst_app_src_push_buffer returned %d \n", gstret);
//return FALSE;
}
}
data->frame_num++;
}
read_iter++;
} else {
GstFlowReturn gstret = gst_app_src_end_of_stream((GstAppSrc *) data->app_source);
if (gstret != GST_FLOW_OK) {
g_print
("gst_app_src_end_of_stream returned %d. EoS not queued successfully.\n",
gstret);
return FALSE;
}
}
return TRUE;
}
/* This signal callback triggers when appsrc needs data. Here,
* we add an idle handler to the mainloop to start pushing
* data into the appsrc */
static void
start_feed(GstElement *source, guint size, CustomData *data) {
if (data->source_id == 0) {
data->source_id = g_idle_add((GSourceFunc) read_data, data);
g_print("start_feed source_id %d \n", data->source_id);
}
}
/* This callback triggers when appsrc has enough data and we can stop sending.
* We remove the idle handler from the mainloop */
static void
stop_feed(GstElement *source, CustomData *data) {
if (data->source_id != 0) {
g_print("stop_feed source_id %d \n", data->source_id);
g_source_remove(data->source_id);
data->source_id = 0;
}
}
static gboolean bus_watch_call(GstBus *bus, GstMessage *msg, gpointer data) {
GMainLoop *loop = (GMainLoop *) data;
g_print("+++ got message %s\n", gst_message_type_get_name(GST_MESSAGE_TYPE (msg)));
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_EOS: {
g_print("End of stream !!!\n");
g_main_loop_quit(loop);
break;
}
case GST_MESSAGE_ERROR: {
gchar *debug;
GError *error;
gst_message_parse_error(msg, &error, &debug);
g_printerr("ERROR from element %s: %s\n", GST_OBJECT_NAME (msg->src), error->message);
if (debug) g_printerr("Error details: %s\n", debug);
g_free(debug);
g_error_free(error);
g_main_loop_quit(loop);
break;
}
case GST_MESSAGE_STATE_CHANGED: {
GstState old_state, new_state, pending_state;
gst_message_parse_state_changed(msg, &old_state, &new_state, &pending_state);
g_print("Pipeline state changed from %s to %s:\n",
gst_element_state_get_name(old_state),
gst_element_state_get_name(new_state));
break;
}
case GST_MESSAGE_STREAM_STATUS: {
GstStreamStatusType type;
GstElement *owner;
const GValue *val;
gchar *path;
GstTask *task = NULL;
g_message ("received STREAM_STATUS");
gst_message_parse_stream_status(msg, &type, &owner);
val = gst_message_get_stream_status_object(msg);
g_message ("type: %d", type);
path = gst_object_get_path_string(GST_MESSAGE_SRC (msg));
g_message ("source: %s", path);
g_free(path);
path = gst_object_get_path_string(GST_OBJECT (owner));
g_message ("owner: %s", path);
g_free(path);
g_message ("object: type %s, value %p", G_VALUE_TYPE_NAME(val), g_value_get_object(val));
break;
}
default:
break;
}
return TRUE;
}
int run_pipeline() {
GMainLoop *loop = g_main_loop_new(NULL, FALSE);
GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE (pipeline));
guint bus_watch_id = gst_bus_add_watch(bus, bus_watch_call, loop);
gst_object_unref(bus);
/* Set the pipeline to "playing" state */
gst_element_set_state(pipeline, GST_STATE_PLAYING);
/* Wait till pipeline encounters an error or EOS */
g_print("===> Running...\n");
g_main_loop_run(loop);
/* Out of the main loop, clean up nicely */
g_print("Returned, stopping playback\n");
gst_element_set_state(pipeline, GST_STATE_NULL);
g_print("Deleting pipeline\n");
gst_object_unref(GST_OBJECT (pipeline));
g_source_remove(bus_watch_id);
g_main_loop_unref(loop);
return 0;
}
GstElement *create_image_source_bin(guint index) {
GstElement *bin = NULL/*, *uri_decode_bin = NULL*/;
gchar bin_name[32] = {};
gchar ele_name[32] = {};
gboolean multi_file_src = FALSE;
/* Create a source GstBin to abstract this bin's content from the rest of the
* pipeline */
g_snprintf(bin_name, sizeof(bin_name) - 1, "source-bin-%02d", index);
bin = gst_bin_new(bin_name);
GstElement *source = NULL, *jpeg_parser = NULL, *decoder = NULL;
source = gst_element_factory_make("appsrc", "source");
// g_snprintf(ele_name, sizeof(ele_name) - 1, "decoder_queue%d", index);
// decoder_queue = gst_element_factory_make("queue", ele_name);
jpeg_parser = gst_element_factory_make("jpegparse", "jpeg-parser");
decoder = gst_element_factory_make("nvv4l2decoder", "nvv4l2-decoder");
if (!source || !jpeg_parser || !decoder) {
g_printerr("One element could not be created. Exiting.\n");
return NULL;
}
app_src_data.app_source = source;
g_object_set(G_OBJECT (source),
"stream-type", GST_APP_STREAM_TYPE_STREAM,
"format", GST_FORMAT_BYTES,
"max-bytes", DEFAULT_MAX_FRAMES,
NULL);
g_signal_connect (source, "need-data", G_CALLBACK(start_feed), &app_src_data);
g_signal_connect (source, "enough-data", G_CALLBACK(stop_feed), &app_src_data);
g_object_set(G_OBJECT(decoder), "cudadec-memtype", 0, NULL);
gst_bin_add_many(GST_BIN(bin), source, jpeg_parser, decoder, NULL);
gst_element_link_many(source, jpeg_parser, decoder, NULL);
/* We need to create a ghost pad for the source bin which will act as a proxy
* for the video decoder src pad. The ghost pad will not have a target right
* now. Once the decode bin creates the video decoder and generates the
* cb_newpad callback, we will set the ghost pad target to the video decoder
* src pad. */
if (!gst_element_add_pad(bin, gst_ghost_pad_new_no_target("src",
GST_PAD_SRC))) {
g_printerr("Failed to add ghost pad in source bin\n");
return NULL;
}
GstPad *srcpad = gst_element_get_static_pad(decoder, "src");
if (!srcpad) {
g_printerr("Failed to get src pad of source bin. Exiting.\n");
return NULL;
}
GstPad *bin_ghost_pad = gst_element_get_static_pad(bin, "src");
if (!gst_ghost_pad_set_target(GST_GHOST_PAD(bin_ghost_pad), srcpad)) {
g_printerr("Failed to link decoder src pad to source bin ghost pad\n");
}
return bin;
}
int build_pipeline() {
GstElement *source_bin = NULL, *streammux = NULL, *pgie = NULL, *transfer = NULL,
*reid = NULL, *nvvidconv2 = NULL, *appsink = NULL;
// int current_device = -1;
// cudaGetDevice(¤t_device);
// struct cudaDeviceProp prop;
// cudaGetDeviceProperties(&prop, current_device);
/* Create gstreamer elements */
/* Create Pipeline element that will form a connection of other elements */
pipeline = gst_pipeline_new("pos-image-track-pipeline");
if (!pipeline) {
g_printerr("Pipeline could not be created. Exiting.\n");
return -1;
}
/* Create nvstreammux instance to form batches from one or more sources. */
streammux = gst_element_factory_make("nvstreammux", "stream-muxer");
if (!streammux) {
g_printerr("nvstreammux could not be created. Exiting.\n");
return -1;
}
/* Set streammux properties */
g_object_set(G_OBJECT (streammux),
"gpu-id", 0,
"nvbuf-memory-type", 2,
"width", 640,
"height", 480,
"batch-size", 1,
"batched-push-timeout", 1000000,
NULL);
gst_bin_add(GST_BIN (pipeline), streammux);
/*Create Source Bin. */
{
int index = 0;
GstPad *sinkpad, *srcpad;
gchar pad_name[16] = {};
source_bin = create_image_source_bin(index);
if (!source_bin) {
g_printerr("Failed to create source bin. Exiting.\n");
return -1;
}
gst_bin_add(GST_BIN (pipeline), source_bin);
g_snprintf(pad_name, 15, "sink_%u", index);
sinkpad = gst_element_get_request_pad(streammux, pad_name);
if (!sinkpad) {
g_printerr("Streammux request sink pad failed. Exiting.\n");
return -1;
}
srcpad = gst_element_get_static_pad(source_bin, "src");
if (!srcpad) {
g_printerr("Failed to get src pad of source bin. Exiting.\n");
return -1;
}
if (gst_pad_link(srcpad, sinkpad) != GST_PAD_LINK_OK) {
g_printerr("Failed to link source bin to stream muxer. Exiting.\n");
return -1;
}
gst_object_unref(srcpad);
gst_object_unref(sinkpad);
}
pgie = gst_element_factory_make("nvinfer", "face-detect");
if (!pgie) {
g_printerr("Primary nvinfer could not be created. Exiting.\n");
return -1;
}
/* Set detect properties */
g_object_set(G_OBJECT (pgie),
"gpu-id", 0,
"config-file-path", "/app/insights_engine/config/skyeye_guard/skyeye_pos/config_hema_face_trtx.cfg",
NULL);
reid = gst_element_factory_make("nvinfer", "face-reid");
if (!reid) {
g_printerr("Second nvinfer for reid could not be created. Exiting.\n");
return -1;
}
/* Set infer properties */
g_object_set(G_OBJECT (reid),
"gpu-id", 0,
"config-file-path", "/app/insights_engine/config/skyeye_guard/skyeye_pos/config_hema_face_reid.cfg",
NULL);
/* Use convertor to convert from NV12 to RGBA as required by nvdsosd */
nvvidconv2 = gst_element_factory_make("nvvideoconvert", "nvvideo-converter2");
if (!nvvidconv2) {
g_printerr("nvvideoconvert2 could not be created. Exiting.\n");
return -1;
}
appsink = gst_element_factory_make("appsink", "app-sink");
if (!appsink) {
g_printerr("Appsink element could not be created. Exiting.\n");
return -1;
}
/* Set up the pipeline */
/* we add all elements into the pipeline */
gst_bin_add_many(GST_BIN (pipeline), pgie, reid, nvvidconv2, appsink, NULL);
/* we link the elements together */
/* source_bin -> streammux -> nvinfer -> reid -> nvvidconv -> appsink */
if (!gst_element_link_many(streammux, pgie, reid, nvvidconv2, appsink, NULL)) {
g_printerr("Elements could not be linked: Exiting.\n");
return -1;
}
/* Configure appsink to extract data from DeepStream pipeline */
g_object_set(appsink, "emit-signals", TRUE, "sync", FALSE, NULL);
/* Callback to access buffer and object info. */
g_signal_connect (appsink, "new-sample", G_CALLBACK(new_sample), &app_src_data);
return 0;
}
static void find_images(const std::string &path,
std::map<std::string, std::string> &out,
const std::string &filerExt = "",
bool include_child = true) {
DIR *d = NULL;
struct dirent *dp = NULL;
struct stat st;
char p[1024] = {0};
if (stat(path.c_str(), &st) < 0 || !S_ISDIR(st.st_mode)) {
//printf("invalid path: %s\n", path.c_str());
return;
}
if (!(d = opendir(path.c_str()))) {
//printf("opendir[%s] error\n", path.c_str());
return;
}
while ((dp = readdir(d)) != NULL) {
if ((!strncmp(dp->d_name, ".", 1)) || (!strncmp(dp->d_name, "..", 2)))
continue;
snprintf(p, sizeof(p) - 1, "%s/%s", path.c_str(), dp->d_name);
stat(p, &st);
if (!S_ISDIR(st.st_mode)) {
//printf("%s/%s\n",path.c_str(), dp->d_name);
if (!filerExt.empty()) {
std::string name(dp->d_name);
auto pos = name.find_last_of(".");
auto ext = name.substr(pos);
//printf("ext %s\n", ext.c_str());
if (0 == ext.compare(filerExt)) {
out[dp->d_name] = p;
}
} else {
out[dp->d_name] = p;
}
} else {
if (include_child) {
//printf("%s/\n", dp->d_name);
find_images(p, out);
}
}
}
closedir(d);
}
int main(int argc, char *argv[]) {
find_images("/app/insights_engine/testdata", image_files, ".jpg", true);
printf("image_files size=%ld.\n", image_files.size());
// Gstreamer 初始化
gst_init(&argc, &argv);
printf("build_pipeline\n");
int ret = build_pipeline();
if (ret == 0) {
printf("run_pipeline\n");
run_pipeline();
}
printf("end_pipeline\n");
}
problem
key test code follow, if use cv::imread and imencode to read image to GstBuffer, run will crash. but use read run ok.
#if 1
{
cv::Mat img = cv::imread(read_iter->second.c_str());
std::vector<int> param = std::vector<int>(2);
param[0] = cv::IMWRITE_JPEG_QUALITY;
param[1] = 100;
std::vector<uchar> data_encode;
imencode(".jpeg", img, data_encode, param);
memset (map.data, 0, data_encode.size());
map.size = data_encode.size();
memcpy(map.data, &data_encode[0], data_encode.size() * sizeof(uchar));
}
#else
{
ret = read(fd, map.data, DEFAULT_FRAME_SIZE);
}
#endif
debug info
0:00:03.911671171 22913 0x555556c74000 DEBUG jpegparse gstjpegparse.c:253:gst_jpeg_parse_get_image_length: 0x0007cd1e: EOI marker
0:00:03.911674336 22913 0x555556c74000 LOG jpegparse gstjpegparse.c:779:gst_jpeg_parse_handle_frame:<jpeg-parser> parsed image of size 511264
0:00:03.911677382 22913 0x555556c74000 DEBUG jpegparse gstjpegparse.c:599:gst_jpeg_parse_read_header:<jpeg-parser> marker = d8
0:00:03.911681282 22913 0x555556c74000 LOG baseparse gstbaseparse.c:2680:gst_base_parse_finish_frame:<jpeg-parser> finished frame at offset 7676850, flushing size 511264
0:00:03.911685093 22913 0x555556c74000 LOG adapter gstadapter.c:973:gst_adapter_get_buffer:<GstAdapter@0x55555650b000> getting buffer of 511264 bytes
0:00:03.911688433 22913 0x555556c74000 LOG adapter gstadapter.c:993:gst_adapter_get_buffer:<GstAdapter@0x55555650b000> providing buffer of 511264 bytes via region copy
0:00:03.911691507 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:844:gst_buffer_new: new 0x555574f87a20
0:00:03.911695432 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:2119:gst_buffer_copy_region: new region copy 0x555574f87a20 of 0x555574f87c60 304050-511264
0:00:03.911699651 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:556:gst_buffer_copy_into: copy 0x555574f87c60 to 0x555574f87a20, offset 304050-511264/921600
0:00:03.911703822 22913 0x555556c74000 DEBUG GST_MEMORY gstmemory.c:138:gst_memory_init: new memory 0x7fff0c22c0f0, maxsize:921607 offset:304050 size:511264
0:00:03.911707676 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:450:_memory_add: buffer 0x555574f87a20, idx -1, mem 0x7fff0c22c0f0
0:00:03.911711145 22913 0x555556c74000 LOG adapter gstadapter.c:634:gst_adapter_flush_unchecked:<GstAdapter@0x55555650b000> flushing 511264 bytes
0:00:03.911714428 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:768:_gst_buffer_free: finalize 0x555574f877e0
0:00:03.911717481 22913 0x555556c74000 DEBUG GST_MEMORY gstmemory.c:88:_gst_memory_free: free memory 0x555556c77460
0:00:03.911720761 22913 0x555556c74000 DEBUG baseparse gstbaseparse.c:2374:gst_base_parse_handle_and_push_frame:<jpeg-parser> no next fallback timestamp
0:00:03.911727190 22913 0x555556c74000 LOG baseparse gstbaseparse.c:2427:gst_base_parse_push_frame:<jpeg-parser> processing buffer of size 511264 with dts 99:99:99.999999999, pts 99:99:99.999999999, duration 99:99:99.999999999
0:00:03.911737406 22913 0x555556c74000 DEBUG GST_CAPS gstpad.c:2704:gst_pad_has_current_caps:<jpeg-parser:src> check current pad caps image/jpeg, parsed=(boolean)true, format=(string)I420, width=(int)640, height=(int)480, framerate=(fraction)1/1
0:00:03.911742592 22913 0x555556c74000 LOG baseparse gstbaseparse.c:2578:gst_base_parse_push_frame:<jpeg-parser> pushing frame (511264 bytes) now..
0:00:03.911750406 22913 0x555556c74000 DEBUG GST_SCHEDULING gstpad.c:4323:gst_pad_chain_data_unchecked:<nvv4l2-decoder:sink> calling chainfunction &gst_video_decoder_chain with buffer buffer: 0x555574f87a20, pts 99:99:99.999999999, dts 99:99:99.999999999, dur 99:99:99.999999999, size 511264, offset 7676850, offset_end none, flags 0x4040
0:00:03.911758794 22913 0x555556c74000 LOG videodecoder gstvideodecoder.c:2407:gst_video_decoder_chain:<nvv4l2-decoder> chain PTS 99:99:99.999999999, DTS 99:99:99.999999999 duration 99:99:99.999999999 size 511264 flags 4040
0:00:03.911763308 22913 0x555556c74000 LOG videodecoder gstvideodecoder.c:2569:gst_video_decoder_new_frame:<nvv4l2-decoder> Created new frame 0x7fff0c22d5a0 (sfn:5)
0:00:03.911766499 22913 0x555556c74000 LOG videodecoder gstvideodecoder.c:2115:gst_video_decoder_chain_forward:<nvv4l2-decoder> Marking current_frame as sync point
0:00:03.911771710 22913 0x555556c74000 LOG videodecoder gstvideodecoder.c:3387:gst_video_decoder_decode_frame:<nvv4l2-decoder> PTS 99:99:99.999999999, DTS 99:99:99.999999999, dist 5
0:00:03.911774955 22913 0x555556c74000 DEBUG default gstsegment.c:737:gst_segment_to_running_time_full: invalid position (-1)
0:00:03.911779925 22913 0x555556c74000 DEBUG v4l2videodec gstv4l2videodec.c:1404:gst_v4l2_video_dec_handle_frame:<nvv4l2-decoder> Handling frame 5
0:00:03.911784684 22913 0x555556c74000 DEBUG v4l2bufferpool gstv4l2bufferpool.c:2077:gst_v4l2_buffer_pool_process:<nvv4l2-decoder:pool:sink> process buffer 0x7fff0c22d5d8
0:00:03.911787905 22913 0x555556c74000 LOG v4l2bufferpool gstv4l2bufferpool.c:2280:gst_v4l2_buffer_pool_process:<nvv4l2-decoder:pool:sink> alloc buffer from our pool
0:00:03.911791157 22913 0x555556c74000 DEBUG v4l2bufferpool gstv4l2bufferpool.c:1641:gst_v4l2_buffer_pool_acquire_buffer:<nvv4l2-decoder:pool:sink> acquire
0:00:03.911794813 22913 0x555556c74000 LOG bufferpool gstbufferpool.c:1123:default_acquire_buffer:<nvv4l2-decoder:pool:sink> acquired buffer 0x555574f87480
0:00:03.911798186 22913 0x555556c74000 LOG v4l2bufferpool gstv4l2bufferpool.c:144:gst_v4l2_buffer_pool_copy_buffer:<nvv4l2-decoder:pool:sink> copying buffer
0:00:03.911801217 22913 0x555556c74000 DEBUG v4l2bufferpool gstv4l2bufferpool.c:176:gst_v4l2_buffer_pool_copy_buffer:<nvv4l2-decoder:pool:sink> copy raw bytes
0:00:03.911805293 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:1800:gst_buffer_map_range: buffer 0x555574f87a20, idx 0, length -1, flags 0001
0:00:03.911809054 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:244:_get_merged_memory: buffer 0x555574f87a20, idx 0, length 1
0:00:03.911812983 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:1904:gst_buffer_fill: buffer 0x555574f87480, offset 0, size 511264
0:00:03.911841483 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:1656:gst_buffer_resize_range: trim 0x555574f87480 0-511264 size:307200 offs:0 max:307200
(my_gst_test:22913): GStreamer-CRITICAL **: 11:13:34.837: gst_buffer_resize_range: assertion 'bufmax >= bufoffs + offset + size' failed
0:00:03.911864673 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:556:gst_buffer_copy_into: copy 0x555574f87a20 to 0x555574f87480, offset 0-511264/511264
0:00:03.911868350 22913 0x555556c74000 LOG GST_PERFORMANCE gstv4l2bufferpool.c:303:gst_v4l2_buffer_pool_copy_buffer:<nvv4l2-decoder:pool:sink> slow copy into buffer 0x555574f87480
0:00:03.911872934 22913 0x555556c74000 LOG v4l2bufferpool gstv4l2bufferpool.c:1375:gst_v4l2_buffer_pool_qbuf:<nvv4l2-decoder:pool:sink> queuing buffer 1
0:00:03.911882835 22913 0x555556c74000 LOG v4l2allocator gstv4l2allocator.c:1405:gst_v4l2_allocator_qbuf:<nvv4l2-decoder:pool:sink:allocator> queued buffer 1 (flags 0x2)
0:00:03.911888429 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:753:_gst_buffer_dispose: release 0x555574f87480 to pool 0x7fff0c227ec0
0:00:03.911893223 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:1656:gst_buffer_resize_range: trim 0x555574f87480 0-307200 size:307200 offs:0 max:307200
0:00:03.911896750 22913 0x555556c74000 DEBUG v4l2bufferpool gstv4l2bufferpool.c:1719:gst_v4l2_buffer_pool_release_buffer:<nvv4l2-decoder:pool:sink> release buffer 0x555574f87480
0:00:03.911900204 22913 0x555556c74000 LOG v4l2bufferpool gstv4l2bufferpool.c:1810:gst_v4l2_buffer_pool_release_buffer:<nvv4l2-decoder:pool:sink> buffer 1 is queued
0:00:03.911903375 22913 0x555556c74000 LOG v4l2bufferpool gstv4l2bufferpool.c:1449:gst_v4l2_buffer_pool_dqbuf:<nvv4l2-decoder:pool:sink> dequeueing a buffer
0:00:03.911908390 22913 0x555556c74000 LOG v4l2allocator gstv4l2allocator.c:1463:gst_v4l2_allocator_dqbuf:<nvv4l2-decoder:pool:sink:allocator> dequeued buffer 0 (flags 0x0)
0:00:03.911915404 22913 0x555556c74000 LOG v4l2bufferpool gstv4l2bufferpool.c:1510:gst_v4l2_buffer_pool_dqbuf:<nvv4l2-decoder:pool:sink> dequeued buffer 0x555574f87360 seq:0 (ix=0), mem 0x555556c774f0 used 64, plane=0, flags 00000000, ts 0:00:00.000000000, pool-queued=1, buffer=0x555574f87360
0:00:03.911920010 22913 0x555556c74000 DEBUG v4l2bufferpool gstv4l2bufferpool.c:1719:gst_v4l2_buffer_pool_release_buffer:<nvv4l2-decoder:pool:sink> release buffer 0x555574f87360
0:00:03.911923710 22913 0x555556c74000 LOG v4l2bufferpool gstv4l2bufferpool.c:1794:gst_v4l2_buffer_pool_release_buffer:<nvv4l2-decoder:pool:sink> buffer 0 not queued, putting on free list
0:00:03.911927516 22913 0x555556c74000 LOG bufferpool gstbufferpool.c:1285:default_release_buffer:<nvv4l2-decoder:pool:sink> released buffer 0x555574f87360 0
0:00:03.911930886 22913 0x555556c74000 DEBUG GST_BUFFER gstbuffer.c:1451:gst_buffer_is_memory_range_writable: idx 0, length -1
0:00:03.911934501 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:844:gst_buffer_new: new 0x555574f877e0
0:00:03.911938861 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:556:gst_buffer_copy_into: copy 0x555574f87a20 to 0x555574f877e0, offset 0-0/511264
0:00:03.911941968 22913 0x555556c74000 LOG GST_BUFFER gstbuffer.c:768:_gst_buffer_free: finalize 0x555574f87a20
0:00:03.911945136 22913 0x555556c74000 DEBUG GST_MEMORY gstmemory.c:88:_gst_memory_free: free memory 0x7fff0c22c0f0
0:00:03.911949959 22913 0x555556c74000 DEBUG GST_SCHEDULING gstpad.c:4329:gst_pad_chain_data_unchecked:<nvv4l2-decoder:sink> called chainfunction &gst_video_decoder_chain with buffer 0x555574f87a20, returned ok
0:00:03.911953864 22913 0x555556c74000 LOG baseparse gstbaseparse.c:2581:gst_base_parse_push_frame:<jpeg-parser> frame pushed, flow ok
0:00:03.911957632 22913 0x555556c74000 LOG baseparse gstbaseparse.c:2206:gst_base_parse_handle_buffer:<jpeg-parser> handle_frame skipped 199031, flushed 511264
**
ERROR:gstbaseparse.c:2210:gst_base_parse_handle_buffer: assertion failed: (*skip == 0 || *flushed == 0)
Bail out! ERROR:gstbaseparse.c:2210:gst_base_parse_handle_buffer: assertion failed: (*skip == 0 || *flushed == 0)
Signal: SIGABRT (Aborted)