<div dir="ltr"><div><div>Hi Timm-Philipp.<br><br>It's been a while (and a couple of version since last, but now I can look into it. Thanks for the links.<br><br></div>Best regards<br></div>Peter<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sun, Jul 28, 2013 at 11:07 PM, Tim-Philipp Müller <span dir="ltr"><<a href="mailto:t.i.m@zen.co.uk" target="_blank">t.i.m@zen.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sun, 2013-07-28 at 11:46 +0200, Peter Maersk-Moller wrote:<br>
<br>
Hi,<br>
<br>
have you looked at GstBufferPool and the ALLOCATION query yet?<br>
<br>
Also<br>
<a href="http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-bufferpool.txt" target="_blank">http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-bufferpool.txt</a><br>
<a href="http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-buffer.txt" target="_blank">http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-buffer.txt</a><br>
<br>
Cheers<br>
 -Tim<br>
<div><div class="h5"><br>
<br>
> I wonder if the GStreamer API offers the possibility of a plugin to<br>
> pass an allocated buffer upstream? An would it be possible for a<br>
> plugin to allocate/construct the buffer from its own memory allocation<br>
> scheme? Technically it would be so difficult, if the API has the right<br>
> hooks. More difficult would it probably be, if a module would like<br>
> pass one of its own allocated buffer downstream, but needs to be told,<br>
> when the buffer is free again.<br>
><br>
><br>
> Passing upstream is very useful if the plugin module shmsink could<br>
> pass a buffer upstream that points to an area in its shared memory.<br>
> Likewise the shmsrc, could pass a buffer downstream pointing to its<br>
> shared memory. I understand that the two cases are technical<br>
> different, especially the downstream is difficult, as the consumer of<br>
> the buffer must signal upstream, that the buffer has been used and are<br>
> free for reuse by the originator of the buffer.<br>
><br>
><br>
> Why is this useful? Imagine you have a video mixer (like Snowmix) that<br>
> needs its input video feeds from shmsink and imagine there are mutiple<br>
> video feeds like 10 feeds and imagine these feeds runs as 1080p at<br>
> 30fps and imagine the format is RGBA for optimal quality, then that<br>
> amounts to around 245MB per second per feed. That is really a lot of<br>
> data. Being able to limit the amount of unnecessary data transfer<br>
> would really help. Imagine a pipeline like below<br>
><br>
><br>
>   gst-launch  some_video_src ! ffdec_h264 ! ffmpegcolorspace ! shmsink<br>
><br>
><br>
> Parameters are left out in this example and the example uses gst<br>
> version 0.10 modules. Version 1.x is slightly different. In the<br>
> example, the system would save a memory transfer if the shmsink module<br>
> could pass a buffer to ffmpegcolorspace pointing directly into shared<br>
> memory thus saving a memory copy. It may not sound like a big deal,<br>
> but with many HD feeds running at the same time, it becomes critical<br>
> for high performance as a computers memory transfer capacity is<br>
> limited, no matter how many cores you put into it. Even if the color<br>
> space conversion module was left out, it would be nice to be able to<br>
> do something like<br>
><br>
>   gst-launch  some_video_src ! ffdec_h264 ! shmsink<br>
>   gst-launch  some_video_src ! ffdec_h264 ! queue ! shmsink<br>
><br>
><br>
> and pass a buffer from shmsink to the decoder. In this example the<br>
> decoder is ffdec_h264, but it could be decodebin or another. I realize<br>
> that it would be extra challenge, as it might need an hack of not only<br>
> the module, but also the decoder the module is based on as it would be<br>
> needed that the internal decoder uses an externally specified buffer<br>
> area for its decoded frame. In the example with the queue inbetween,<br>
> it would be optimal, if the queue module receives the buffers from<br>
> shmsink point to its shared memory and not only uses them, but also<br>
> pass them along upstream.<br>
><br>
><br>
> For the upstream, the scenario is a little different.. Here you could<br>
> have something like<br>
><br>
><br>
>   gst-launch shmsrc ! ffmpegcolorspace ! x264enc<br>
>   gst-launch shmsrc ! queue ! x264enc<br>
><br>
><br>
> The example is without parameters. Here the colour space module or the<br>
> queue module would need to signal upstream, when the buffer has been<br>
> used and discarded .... and it this case, it would need to discard the<br>
> buffer in a sensible manner.<br>
><br>
><br>
><br>
> I realize this is all a very special case, but as we get more and more<br>
> HD video, this is becoming important as use of GStreamer for high end<br>
> video systems are growing. Imagine also the savings when jumping from<br>
> 1080p to 4k videos. Now mainstream 4k video is still in the future,<br>
> but it will come.<br>
><br>
><br>
> Feel free to also take a look at<br>
> <a href="http://lists.freedesktop.org/archives/gstreamer-devel/2013-July/041987.html" target="_blank">http://lists.freedesktop.org/archives/gstreamer-devel/2013-July/041987.html</a><br>
><br>
><br>
><br>
> Best regards<br>
><br>
> Peter Maersk-Moller<br>
><br>
</div></div>> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div><br></div>