|
Hi,
Im trying to decode h264 frame, im using appsink and appsrc method as the follow:
decode_buffer(uint8_t* pBuf, int len, gst_app_t* pipline)
{
printf("got new buffer!!!\n");
GstStateChangeReturn state_ret;
GstElement* testsink = NULL;
ProgramData* data = NULL;
// gst_init(NULL, NULL); // Initialize Gstreamer
gst_app_t* app = pipline;
GstElementFactory* srcfactory;
pipline->timestamp = 0; // Set timestamp to 0
g_assert(pBuf != NULL);
GstBuffer* buffer = gst_buffer_new_and_alloc(len);
gst_buffer_fill(buffer, 0, pBuf, len);
auto clock = gst_element_get_clock(GST_ELEMENT_CAST(app->src));
if (clock)
{
auto base_time = gst_element_get_base_time(GST_ELEMENT_CAST(app->src));
auto now = gst_clock_get_time(clock);
if (now > base_time)
now -= base_time;
else
now = 0;
gst_object_unref(clock);
GST_BUFFER_PTS(buffer) = now;
GST_BUFFER_DTS(buffer) = now;
}
GstFlowReturn ret = gst_app_src_push_buffer(app->src, buffer);
cout << ret << endl;
g_assert(GST_FLOW_OK == ret);
pipline->last_time_buffer = end;
usleep(1000);
// gst_buffer_unref(buffer);
}
when i using this method i success to decode only 3 frames and than i get the following message:
091:gst_clock_get_time:<GstSystemClock> adjusted time 1:27:44.882934836
0:00:02.052908983 32105 0x7f64002520 DEBUG appsrc gstappsrc.c:1819:gst_app_src_push_internal:<mysource> queue filled (200226 >= 200000)
0:00:02.052941784 32105 0x7f64002520 DEBUG appsrc gstappsrc.c:1819:gst_app_src_push_internal:<mysource> queue filled (200226 >= 200000)
0:00:02.052980761 32105 0x7f64002520 DEBUG appsrc gstappsrc.c:1863:gst_app_src_push_internal:<mysource> queueing buffer 0x7f700291e0
why the appsink not cleared?
|