<div dir="ltr"><div>Hi. </div><div><br></div><div>I did something similar in the past but did not finish in the receiver side, therefore I do not have guaranties if it is the publisher or the receiver that have the issue, The only guarantee I have is that the buffers are transfered and the sizes are corente in the receiver side. </div><div><br></div><div><br></div><div><div><span class="" style="white-space:pre">          </span>    size_t size;</div><div>       <span class="" style="white-space:pre">              </span>    GstMemory *memory;</div><div>        <span class="" style="white-space:pre">       </span>    GstMapInfo info;</div><div>                   </div><div><span class="" style="white-space:pre">         </span>    </div><div>                    /* allocate memory and add to the buffer */</div><div><span class="" style="white-space:pre">             </span>        size = samples[i].payload.length();</div><div><span class="" style="white-space:pre">                    </span>buffer = gst_buffer_new_and_alloc(size);</div><div><span class="" style="white-space:pre">           </span>   <span class="" style="white-space:pre">      </span>//std::cout << "Payload size " << size << std::endl;</div><div><span class="" style="white-space:pre">                   </span>memory = gst_allocator_alloc (NULL, size, NULL);</div><div><span class="" style="white-space:pre">           </span></div><div><span class="" style="white-space:pre">           </span>        gst_buffer_append_memory (buffer, memory);</div><div><span class="" style="white-space:pre">             </span></div><div><span class="" style="white-space:pre">           </span>        /* get WRITE access to the memory and copy image */</div><div><span class="" style="white-space:pre">            </span>        gst_buffer_map (buffer, &info, GST_MAP_WRITE);</div><div>                        //std::cout << "Memory copy before" << std::endl;</div><div><span class="" style="white-space:pre">                   </span>//memcpy(buffer, (void*)samples[i].payload[0], size);</div><div>                        int j;</div><div>        <span class="" style="white-space:pre">         </span>for (j = 0; j < size; j++){</div><div><span class="" style="white-space:pre">                             </span>*((char *) info.data + j) = samples[i].payload[j];</div><div><span class="" style="white-space:pre">                         </span></div><div><span class="" style="white-space:pre">                   </span>}</div><div><span class="" style="white-space:pre">                  </span>//std::cout << "Memory copy after" << std::endl;</div><div>        <span class="" style="white-space:pre">         </span>gst_buffer_unmap (buffer, &info);</div><div><br></div><div>            <span class="" style="white-space:pre">           </span>//pthread_mutex_lock(&mutex);</div><div><span class="" style="white-space:pre">                  </span>//<span class="" style="white-space:pre">        </span>myBufferDeque.push_back(buffer);</div><div><span class="" style="white-space:pre">                   </span>//pthread_mutex_unlock(&mutex);</div><div> <span class="" style="white-space:pre">                      </span>printf("pushing buffer: %s\n",gst_flow_get_name (</div><div>        <span class="" style="white-space:pre">                            </span>gst_app_src_push_buffer (GST_APP_SRC (source), buffer)</div><div>         <span class="" style="white-space:pre">                       </span>))</div><div>          <span class="" style="white-space:pre">                  </span>;</div><div><br></div><div>                }</div><div>            }</div></div><div><br></div><div><br></div><div>In the receiver side you need something like the following code</div><div><br></div><div><br></div><div>GstAppSink *sink,<br></div><div><br></div><div><div>  /* Retrieve the buffer */</div><div>  GstSample *gst_sample = gst_app_sink_pull_sample(sink);</div><div>  if (NULL == gst_sample) {</div><div><span class="" style="white-space:pre">    </span>g_warning("error getting Gstreamer sample");</div><div>  } else {</div><div>  <span class="" style="white-space:pre">        </span>buffer = gst_sample_get_buffer(gst_sample);</div><div>  <span class="" style="white-space:pre">     </span>if(buffer != NULL) {</div><div><span class="" style="white-space:pre">               </span>GstMapInfo bufferInfo;</div><div><span class="" style="white-space:pre">             </span>gst_buffer_map(buffer, &bufferInfo, GST_MAP_READ);</div><div><span class="" style="white-space:pre">             </span>g_print ("**** nsize=%d ***** ", bufferInfo.size);<span class="" style="white-space:pre">      </span></div><div><span class="" style="white-space:pre">           </span>//bufferInfo.data</div><div><span class="" style="white-space:pre">          </span>//Todo: copy data to the sample or use loan buffers<span class="" style="white-space:pre">       </span></div><div><span class="" style="white-space:pre">           </span>if (bufferInfo.size < data->payloadSize) {</div><div><span class="" style="white-space:pre">                   </span>(*(data->sample)).payload.length(bufferInfo.size);<span class="" style="white-space:pre">     </span></div><div><span class="" style="white-space:pre">                   </span>for(unsigned long j = 0; j < bufferInfo.size; j++)</div><div><span class="" style="white-space:pre">                      </span>{</div><div><span class="" style="white-space:pre">                  </span> //data->sample[j] = bufferInfo.data[j];</div><div><span class="" style="white-space:pre">                        </span> (*(data->sample)).payload[j] = bufferInfo.data[j];</div><div><span class="" style="white-space:pre">                     </span>}</div><div><br></div><div><span class="" style="white-space:pre">                 </span>data->sample->count++;</div><div><span class="" style="white-space:pre">                       </span>std::cout<< "count [" << data->sample->count << "]" << std::endl;</div><div><span class="" style="white-space:pre">                        </span>status = data->e->writer->write(*(data->sample), *(data->handle));</div><div><span class="" style="white-space:pre">                  </span>CHECK_STATUS_MACRO(status);</div><div> <span class="" style="white-space:pre">              </span>} else {</div><div><span class="" style="white-space:pre">                   </span>g_print ("**** BUFFER SIZE IS TOO HIGH %d ***** ", bufferInfo.size);<span class="" style="white-space:pre">    </span></div><div><span class="" style="white-space:pre">           </span>}</div><div><span class="" style="white-space:pre">          </span></div><div><span class="" style="white-space:pre">           </span>gst_buffer_unmap(buffer, &bufferInfo);</div><div><span class="" style="white-space:pre">         </span></div><div>        }<span class="" style="white-space:pre">      </span></div><div><span class="" style="white-space:pre">   </span>gst_sample_unref(gst_sample); <span class="" style="white-space:pre">    </span></div><div>  }</div><div><br></div><div>  return GST_FLOW_OK;</div></div><div><br></div><div><br></div><div><br></div><div>We can work this out together in the near future and hope the  code works for your needs. </div><div><br></div><div>Regards,</div><div>JoaoM.   </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 2, 2015 at 11:36 AM, vkcorp <span dir="ltr"><<a href="mailto:vkcorp@naver.com" target="_blank">vkcorp@naver.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm trying to check appsrc's code to track how it works.<br>
I usually call gst_app_src_push_buffer() to feed it,<br>
but I can't find it to transfer next elements on pipeline.<br>
<br>
I guess appsrc receive buffer and provide it to next element.<br>
<br>
I just found gst_app_src_create() function but it just pop out buffer from<br>
queue<br>
and wouldn't send it to next element.<br>
Actually I expected some kind of push_buffer() kinds of functions on it.<br>
<br>
Are there any push functions on appsrc inside ?<br>
Or maybe on basesrc ?<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/how-appsrc-work-tp4672535.html" rel="noreferrer" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/how-appsrc-work-tp4672535.html</a><br>
Sent from the GStreamer-devel mailing list archive at Nabble.com.<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" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div><br></div>