<div dir="ltr"><div><b>Context:</b> I'm making a server that composites various sources of media into a video stream(like a 2x2 grid from different sources for instance) and supports multiple streams at the same time (including being able to update those pipelines dynamically with web calls in the future). One source is an image(image/png) that gets generated upon request by a separate microservice. I was trying to use an Appsrc to pull the image and then push it into a PngDec --> ImageFreeze and then link that to the composite element with the sink properties for which part of the grid it should show on. <br></div><div>I've got it pulling the image and pushing that buffer, but I'm getting the error below, and I'm not sure exactly what's causing it.<br><br><b>Questions:</b></div><div>1. What do you think is happening and what's the best way to resolve it? </div><div>2. Is there a better way for me to do this?</div><div>3. Knowing that I plan to have multiple streams pulling from multiple sources and want to update them live, any pointers?</div><br><div><b>Error:</b></div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">should have image</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">should have image in pipeline: Ok</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Error from Some("/GstPipeline:pipeline_6be3b6be-0767-49db-a2b1-26708950261b/GstAppSrc:vsource0_top_left"): Internal data stream error. (Some("../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline_6be3b6be-0767-49db-a2b1-26708950261b/GstAppSrc:vsource0_top_left:\nstreaming stopped, reason not-negotiated (-4)"))<br></blockquote><div><br><b>Code:</b></div><div><span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;color:rgb(86,156,214)">let</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre"> </span><span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;color:rgb(156,220,254)">vsource</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre"> </span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre">=</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre"> </span><span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;color:rgb(220,220,170)">gst_create_element</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre">(</span><span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;color:rgb(206,145,120)">"appsrc"</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre">, </span><span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;color:rgb(156,220,254)">name</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre">)</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre">?</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre">;</span></div><div style="line-height:18px"><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(86,156,214)">mut</span> <span style="color:rgb(156,220,254);text-decoration-line:underline">location</span> = <span style="color:rgb(206,145,120)">""</span>.<span style="color:rgb(220,220,170)">to_string</span>();</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(86,156,214)">mut</span> <span style="color:rgb(156,220,254);text-decoration-line:underline">body</span> = <span style="color:rgb(206,145,120)">""</span>.<span style="color:rgb(220,220,170)">to_string</span>();</div><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">for</span> (<span style="color:rgb(156,220,254)">key</span>, <span style="color:rgb(156,220,254)">value</span>) <span style="color:rgb(197,134,192)">in</span> <span style="color:rgb(156,220,254)">src_properties</span>.<span style="color:rgb(220,220,170)">iter</span>() {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">if</span> <span style="color:rgb(156,220,254)">key</span> == <span style="color:rgb(206,145,120)">"url"</span> {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254);text-decoration-line:underline">location</span> = <span style="color:rgb(156,220,254)">value</span>.<span style="color:rgb(220,220,170)">to_string</span>();</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> } <span style="color:rgb(197,134,192)">else</span> <span style="color:rgb(197,134,192)">if</span> <span style="color:rgb(156,220,254)">key</span> == <span style="color:rgb(206,145,120)">"payload"</span> {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254);text-decoration-line:underline">body</span> = <span style="color:rgb(78,201,176)">String</span>::<span style="color:rgb(220,220,170)">from</span>(<span style="color:rgb(156,220,254)">value</span>);</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">pngdec</span> = <span style="color:rgb(220,220,170)">gst_create_element</span>(<span style="color:rgb(206,145,120)">"pngdec"</span>,<span style="color:rgb(86,156,214)">format</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"pngdec_</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">_</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>,<span style="color:rgb(156,220,254)">name</span>,<span style="color:rgb(156,220,254)">index</span>).<span style="color:rgb(220,220,170)">as_str</span>())?;</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">imagefreeze</span> = <span style="color:rgb(220,220,170)">gst_create_element</span>(<span style="color:rgb(206,145,120)">"imagefreeze"</span>,<span style="color:rgb(86,156,214)">format</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"imagefreeze_</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">_</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>,<span style="color:rgb(156,220,254)">name</span>,<span style="color:rgb(156,220,254)">index</span>).<span style="color:rgb(220,220,170)">as_str</span>())?;</div><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">println</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"adding source"</span>);</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">local_pipeline</span> = <span style="color:rgb(156,220,254)">pipeline</span>.<span style="color:rgb(220,220,170)">lock</span>().<span style="color:rgb(220,220,170)">unwrap</span>();</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">local_pipeline</span>.<span style="color:rgb(220,220,170)">add_many</span>(&[&<span style="color:rgb(156,220,254)">vsource</span>, &<span style="color:rgb(156,220,254)">pngdec</span>, &<span style="color:rgb(156,220,254)">imagefreeze</span>])?;</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(220,220,170)">drop</span>(<span style="color:rgb(156,220,254)">local_pipeline</span>);</div><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">Element</span>::<span style="color:rgb(220,220,170)">link_many</span>(&[&<span style="color:rgb(156,220,254)">vsource</span>, &<span style="color:rgb(156,220,254)">pngdec</span>, &<span style="color:rgb(156,220,254)">imagefreeze</span>])?;</div><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(220,220,170)">gst_add_element_to_comp</span>(</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">pipeline</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> &<span style="color:rgb(156,220,254)">imagefreeze</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">name</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">None</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"><span style="color:rgb(106,153,85)"> </span><span style="color:rgb(106,153,85)">// src_caps,</span></div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">sink_properties</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">comp</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">index</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> )?;</div><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">appsrc</span> = <span style="color:rgb(156,220,254)">vsource</span></div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> .<span style="color:rgb(220,220,170)">dynamic_cast</span>::<<span style="color:rgb(78,201,176)">gst_app</span>::<span style="color:rgb(78,201,176)">AppSrc</span>>()</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> .<span style="color:rgb(220,220,170)">expect</span>(<span style="color:rgb(206,145,120)">"Source element is expected to be an appsrc!"</span>);</div><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">appsrc</span>.<span style="color:rgb(220,220,170)">set_caps</span>(<span style="color:rgb(156,220,254)">src_caps</span>);</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">appsrc</span>.<span style="color:rgb(220,220,170)">set_format</span>(<span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">Format</span>::<span style="color:rgb(79,193,255)">Bytes</span>);</div><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">appsrc</span>.<span style="color:rgb(220,220,170)">set_callbacks</span>(</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(78,201,176)">gst_app</span>::<span style="color:rgb(78,201,176)">AppSrcCallbacks</span>::<span style="color:rgb(220,220,170)">builder</span>()</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> .<span style="color:rgb(220,220,170)">need_data</span>(<span style="color:rgb(86,156,214)">move</span> |<span style="color:rgb(156,220,254)">appsrc</span>, <span style="color:rgb(156,220,254)">_</span>| {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">if</span> <span style="color:rgb(156,220,254);text-decoration-line:underline">location</span> == <span style="color:rgb(206,145,120)">""</span> {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">_</span> = <span style="color:rgb(156,220,254)">appsrc</span>.<span style="color:rgb(220,220,170)">end_of_stream</span>();</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">return</span>;</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><br><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">println</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"Producing frame"</span>);</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">client</span> = <span style="color:rgb(78,201,176)">reqwest</span>::<span style="color:rgb(78,201,176)">blocking</span>::<span style="color:rgb(78,201,176)">Client</span>::<span style="color:rgb(220,220,170)">new</span>();</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">our_body</span> = <span style="color:rgb(156,220,254);text-decoration-line:underline">body</span>.<span style="color:rgb(220,220,170)">clone</span>();</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">resp_result</span> = <span style="color:rgb(156,220,254)">client</span>.<span style="color:rgb(220,220,170)">post</span>(<span style="color:rgb(156,220,254);text-decoration-line:underline">location</span>.<span style="color:rgb(220,220,170)">as_str</span>()).<span style="color:rgb(220,220,170)">body</span>(<span style="color:rgb(156,220,254)">our_body</span>).<span style="color:rgb(220,220,170)">send</span>();</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">match</span> <span style="color:rgb(156,220,254)">resp_result</span> {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Ok</span>(<span style="color:rgb(156,220,254)">resp</span>) => {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">if</span> <span style="color:rgb(156,220,254)">resp</span>.<span style="color:rgb(220,220,170)">status</span>().<span style="color:rgb(220,220,170)">is_success</span>() {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">println</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"should have image"</span>);</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">match</span> <span style="color:rgb(156,220,254)">resp</span>.<span style="color:rgb(220,220,170)">bytes</span>() {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Ok</span>(<span style="color:rgb(156,220,254)">bytes</span>) => {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">buf</span> = <span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">Buffer</span>::<span style="color:rgb(220,220,170)">from_slice</span>(<span style="color:rgb(156,220,254)">bytes</span>);</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">match</span> <span style="color:rgb(156,220,254)">appsrc</span>.<span style="color:rgb(220,220,170)">push_buffer</span>(<span style="color:rgb(156,220,254)">buf</span>) {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Ok</span>(<span style="color:rgb(156,220,254)">suc</span>) => {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">println</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"should have image in pipeline: </span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">:</span><span style="color:rgb(86,156,214)">?</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">suc</span>)</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Err</span>(<span style="color:rgb(156,220,254)">err</span>) => <span style="color:rgb(86,156,214)">println</span><span style="color:rgb(220,220,170)">!</span>(</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(206,145,120)">"error putting image in pipeline: </span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">:</span><span style="color:rgb(86,156,214)">?</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">err</span></div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> ),</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> };</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Err</span>(<span style="color:rgb(156,220,254)">err</span>) => {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">appsrc</span>.<span style="color:rgb(220,220,170)">post_error_message</span>(<span style="color:rgb(78,201,176)">ErrorMessage</span>::<span style="color:rgb(220,220,170)">new</span>(</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> &<span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">CoreError</span>::<span style="color:rgb(79,193,255)">Failed</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Some</span>(</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">format</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"no bytes from image request:</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">:</span><span style="color:rgb(86,156,214)">?</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">err</span>)</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> .<span style="color:rgb(220,220,170)">as_str</span>(),</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> ),</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Some</span>(</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">format</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"no bytes from image request:</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">:</span><span style="color:rgb(86,156,214)">?</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">err</span>)</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> .<span style="color:rgb(220,220,170)">as_str</span>(),</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> ),</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(206,145,120)">"filename"</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(206,145,120)">"function"</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(181,206,168)">100</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> ));</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">return</span>;</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> } <span style="color:rgb(197,134,192)">else</span> {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(86,156,214)">println</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"error getting image: </span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">:</span><span style="color:rgb(86,156,214)">?</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">resp</span>.<span style="color:rgb(220,220,170)">status</span>());</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Err</span>(<span style="color:rgb(156,220,254)">err</span>) => {</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(156,220,254)">appsrc</span>.<span style="color:rgb(220,220,170)">post_error_message</span>(<span style="color:rgb(78,201,176)">ErrorMessage</span>::<span style="color:rgb(220,220,170)">new</span>(</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> &<span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">CoreError</span>::<span style="color:rgb(79,193,255)">Failed</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Some</span>(<span style="color:rgb(86,156,214)">format</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"no response from image request:</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">:</span><span style="color:rgb(86,156,214)">?</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">err</span>).<span style="color:rgb(220,220,170)">as_str</span>()),</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(79,193,255)">Some</span>(<span style="color:rgb(86,156,214)">format</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"no response from image request:</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">:</span><span style="color:rgb(86,156,214)">?</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">err</span>).<span style="color:rgb(220,220,170)">as_str</span>()),</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(206,145,120)">"filename"</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(206,145,120)">"function"</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(181,206,168)">116</span>,</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> ));</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> <span style="color:rgb(197,134,192)">return</span>;</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> }</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> })</div><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> .<span style="color:rgb(220,220,170)">build</span>(),</div><div style=""><font color="#d4d4d4" face="Menlo, Monaco, Courier New, monospace"><span style="font-size:12px;white-space:pre;background-color:rgb(30,30,30)"> );
</span></font><div style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre;background-color:rgb(30,30,30);line-height:18px"><div><span style="color:rgb(106,153,85)">// Assumes that the element is already in the pipeline</span></div><div><span style="color:rgb(86,156,214)">pub</span> <span style="color:rgb(86,156,214)">fn</span> <span style="color:rgb(220,220,170)">gst_add_element_to_comp</span>(</div><div> <span style="color:rgb(156,220,254)">pipeline</span>: &<span style="color:rgb(78,201,176)">Arc</span><<span style="color:rgb(78,201,176)">Mutex</span><<span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">Pipeline</span>>>,</div><div> <span style="color:rgb(156,220,254)">vsource</span>: &<span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">Element</span>,</div><div> <span style="color:rgb(156,220,254)">name</span>: &<span style="color:rgb(78,201,176)">str</span>,</div><div> <span style="color:rgb(156,220,254)">src_caps</span>: <span style="color:rgb(78,201,176)">Option</span><&<span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">Caps</span>>,</div><div> <span style="color:rgb(156,220,254)">sink_properties</span>: <span style="color:rgb(78,201,176)">HashMap</span><<span style="color:rgb(78,201,176)">String</span>, <span style="color:rgb(78,201,176)">String</span>>,</div><div> <span style="color:rgb(156,220,254)">comp</span>: &<span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">Element</span>,</div><div> <span style="color:rgb(156,220,254)">index</span>: <span style="color:rgb(78,201,176)">i32</span>,</div><div>) -> <span style="color:rgb(78,201,176)">Result</span><()> {</div><div> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">vconvert</span> = <span style="color:rgb(220,220,170)">gst_create_element</span>(<span style="color:rgb(206,145,120)">"videoconvert"</span>, &<span style="color:rgb(86,156,214)">format</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"vconvert_</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">name</span>))?;</div><div> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">vqueue</span> = <span style="color:rgb(220,220,170)">gst_create_element</span>(<span style="color:rgb(206,145,120)">"queue"</span>, &<span style="color:rgb(86,156,214)">format</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"v</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">_queue_for_</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">index</span>, <span style="color:rgb(156,220,254)">name</span>))?;</div><div> </div><div> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">sink</span> = <span style="color:rgb(156,220,254)">comp</span>.<span style="color:rgb(220,220,170)">request_pad_simple</span>(&<span style="color:rgb(86,156,214)">format</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"sink_</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">index</span>)).<span style="color:rgb(220,220,170)">unwrap</span>();</div><div> <span style="color:rgb(197,134,192)">for</span> (<span style="color:rgb(156,220,254)">key</span>, <span style="color:rgb(156,220,254)">value</span>) <span style="color:rgb(197,134,192)">in</span> <span style="color:rgb(156,220,254)">sink_properties</span>.<span style="color:rgb(220,220,170)">iter</span>() {</div><div> <span style="color:rgb(156,220,254)">sink</span>.<span style="color:rgb(220,220,170)">set_property_from_str</span>(<span style="color:rgb(156,220,254)">key</span>, <span style="color:rgb(156,220,254)">value</span>);</div><div> }<br></div><br><div> <span style="color:rgb(156,220,254)">vqueue</span>.<span style="color:rgb(220,220,170)">set_property_from_str</span>(<span style="color:rgb(206,145,120)">"leaky"</span>, <span style="color:rgb(206,145,120)">"1"</span>);</div><br><div> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(156,220,254)">local_pipeline</span> = <span style="color:rgb(156,220,254)">pipeline</span>.<span style="color:rgb(220,220,170)">lock</span>().<span style="color:rgb(220,220,170)">unwrap</span>();</div><div> <span style="color:rgb(156,220,254)">local_pipeline</span>.<span style="color:rgb(220,220,170)">add_many</span>(&[&<span style="color:rgb(156,220,254)">vconvert</span>, &<span style="color:rgb(156,220,254)">vqueue</span>])?;</div><div> <span style="color:rgb(220,220,170)">drop</span>(<span style="color:rgb(156,220,254)">local_pipeline</span>);<br></div><br><div> <span style="color:rgb(197,134,192)">if</span> <span style="color:rgb(86,156,214)">let</span> <span style="color:rgb(79,193,255)">Some</span>(<span style="color:rgb(156,220,254)">caps</span>) = <span style="color:rgb(156,220,254)">src_caps</span> {</div><div> <span style="color:rgb(86,156,214)">println</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"link with caps: </span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">:</span><span style="color:rgb(86,156,214)">?</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">caps</span>);</div><div> <span style="color:rgb(156,220,254)">vsource</span>.<span style="color:rgb(220,220,170)">link_filtered</span>(&<span style="color:rgb(156,220,254)">vconvert</span>, &<span style="color:rgb(156,220,254)">caps</span>)?;</div><div> } <span style="color:rgb(197,134,192)">else</span> {</div><div> <span style="color:rgb(86,156,214)">println</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"link"</span>);</div><div> <span style="color:rgb(156,220,254)">vsource</span>.<span style="color:rgb(220,220,170)">link</span>(&<span style="color:rgb(156,220,254)">vconvert</span>)?;</div><div> }</div><br><div> <span style="color:rgb(197,134,192)">match</span> <span style="color:rgb(78,201,176)">gst</span>::<span style="color:rgb(78,201,176)">Element</span>::<span style="color:rgb(220,220,170)">link_many</span>(&[&<span style="color:rgb(156,220,254)">vconvert</span>, &<span style="color:rgb(156,220,254)">vqueue</span>, &<span style="color:rgb(156,220,254)">comp</span>]) {</div><div> <span style="color:rgb(79,193,255)">Ok</span>(<span style="color:rgb(156,220,254)">_</span>) => (),</div><div> <span style="color:rgb(79,193,255)">Err</span>(<span style="color:rgb(156,220,254)">err</span>) => {</div><div> <span style="color:rgb(86,156,214)">println</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(206,145,120)">"Got error:</span><span style="color:rgb(86,156,214)">{</span><span style="color:rgb(86,156,214)">:</span><span style="color:rgb(86,156,214)">?</span><span style="color:rgb(86,156,214)">}</span><span style="color:rgb(206,145,120)">"</span>, <span style="color:rgb(156,220,254)">err</span>);</div><div> <span style="color:rgb(197,134,192)">return</span> <span style="color:rgb(79,193,255)">Err</span>(<span style="color:rgb(86,156,214)">eyre</span><span style="color:rgb(220,220,170)">!</span>(<span style="color:rgb(156,220,254)">err</span>));</div><div> }</div><div> };</div><div> <span style="color:rgb(79,193,255)">Ok</span>(())</div><div>}</div></div>
</div><div style="line-height:18px">The Pipeline and composite elements are created in the logic before these and I have test patterns working great, it's just when I start getting fancier that this issue pops up.</div><br>Thanks for any input! I've been coding for a long time, but fairly new to rust and gstreamer so appologies if this is some stupid issue. I'd love any pointers/wisdom you have to share!</div><div style="line-height:18px">-Matt</div></div>