How to retrieve attached custom meta information on receiver side?

Nicolas Dufresne nicolas at ndufresne.ca
Wed Mar 18 14:11:30 UTC 2020


Le mercredi 18 mars 2020 à 14:54 +0300, Борис a écrit :
> Hi. I added my custom meta data and can't retrieve it on receiver side
> On sender side i have rtsp server and i'm adding meta info to frame buffers (i skip some of not important parts of code):

GstMeta are not generically serialized through RTP protocol. You have
to serialize / unserialize this through custom element or pad probes.
You can you the extension headers to store this information in the RTP
packet.

> 
>     buffer = gst_buffer_new_wrapped(frame.data, size);
> ...
>         GST_BUFFER_PTS (buffer) = ts;
>         GST_BUFFER_DTS (buffer) = ts;
> 
>         qint64 duration = ((double)1 / params.framerate) * GST_SECOND;
>         GST_BUFFER_DURATION(buffer) = duration;
>         GST_BUFFER_OFFSET(buffer) = currentFrameCount;
> 
>         // ADD META
>         GstMetaMarking* meta = GST_META_MARKING_ADD(buffer);
>         meta->in_timestamp = it->time;
>         if (currentFrameCount >= needFrameCount)
>         {
>             meta->last = true;
>         }
>         else
>         {
>             meta->last = false;
>         }
>       // here i check that meta added correctly
>         GstMetaMarking* metaCheck = GST_META_MARKING_GET(buffer);
>         qDebug() << metaCheck->in_timestamp << metaCheck->last;
>         g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret);
>         gst_buffer_unref (buffer);
> 
> On receiver side i modified part where i retrieve frame:
> ...
> sample = gst_app_sink_pull_sample(GST_APP_SINK(sink));
> ...
> GstBuffer * buf = gst_sample_get_buffer(sample);
> if (!buf)
>         return false;
> 
> // RETRIEVE META
> GstMetaMarking* meta = GST_META_MARKING_GET(buf);
> if (meta)
> {
> CV_WARN("GStreamer: META EXISTS");
> tsMeta = meta->in_timestamp;
> isLastMeta = meta->last;
> }	
> else
> {
> CV_WARN("GStreamer: META IS EMPTY"); // so i'm always here
> }
>     GstMapInfo info;
>     if (!gst_buffer_map(buf, &info, GST_MAP_READ))
>     {
>         //something weird went wrong here. abort. abort.
>         CV_WARN("Failed to map GStreamerbuffer to system memory");
>         return false;
>     }
> 
>     {
>         Mat src;
>         if (isOutputByteBuffer)
>             src = Mat(Size(info.size, 1), CV_8UC1, info.data);
>         else
>             src = Mat(sz, CV_MAKETYPE(CV_8U, channels), info.data);
>         CV_Assert(src.isContinuous());
>         src.copyTo(dst);
>     }
>     gst_buffer_unmap(buf, &info);
> 
> 
> 
> So, here
>   GstMetaMarking* meta = GST_META_MARKING_GET(buf); 
> 
> i always get empty pointer. What is wrong here? 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list