<div>Hi everyone,<br clear="all"></div><div><br></div><div>this is my first post on this list, I hope I&#39;ll make things right.</div><div>If no please tell me.</div><div><br></div><div>So, I want to integrate Gstreamer in a discrete event simulation environment (Omnet++).</div>
<div>I want to integrate network delay into a streaming application.</div><div>My idea is to execute the gstreamer pipelines (server and client) on a local PC.</div><div>Here are the pipelines corresponding to my application :</div>
<div><br></div><div>Server:</div><div>gst-launch -v -e videotestsrc ! video/x-raw-yuv, framerate=25/1, width=640, height=480 ! ffmpegcolorspace ! x264enc  byte-stream=true bitrate=2048 ! rtph264pay ! udpsink port=5000 host=127.0.0.1 </div>
<div><br></div><div>Client:</div><div> gst-launch -v -e udpsrc caps=&quot;application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96&quot; port=5000 ! rtph264depay ! capsfilter caps=&quot;video/x-h264,width=(int)640, height=(int)480, framerate=(fraction)25/1&quot; ! qtmux ! filesink location=/tmp/video.mp4</div>
<div><br></div><div><br></div><div>Then I added probes on the udpsink pad to get the data that are going to be sent on the local socket.</div><div>This triggers network event in my simulation environment,</div><div>On the receiver pipeline, I want to add the network delay to the timestamp of the received packet.</div>
<div>I also want to simulate packet loss.</div><div>I&#39;ve done that by adding a probe on the udpsrc pad.</div><div> </div><div>here is the code I used :</div><div>...</div><div>pad = gst_element_get_pad (udpsrc, &quot;src&quot;);<br>
                gst_pad_add_buffer_probe (pad, G_CALLBACK (c_udp_src_pad), NULL);<br>                gst_object_unref (pad);</div><div>...</div><div><br></div><div>static gboolean c_udp_src_pad(GstPad *pad, GstBuffer *buffer, gpointer u_data)<br>{</div>
<div>   gboolean ret;</div><div>   gst_element_set_state (pipeline, GST_STATE_PAUSED);</div><div>   If (corresponding omnet packet is lost){</div><div>      ret=FALSE;</div><div>   }</div><div>   else{</div><div>      buffer-&gt;timestamp= buffer-&gt;timestamp + net_delay;</div>
<div>      ret = TRUE;</div><div>   }</div><div>   gst_element_set_state (pipeline, GST_STATE_PLAYING);</div><div>   return ret;</div><div>}</div><div><br></div><div>What I expect to have is :</div><div> - the lost packets removed from the client pipeline</div>
<div> - the network delay taken into account in the client pipeline.</div><div><br></div><div>My questions are :</div><div><br></div><div>1/ Is my approach correct ?</div><div><br></div><div>2/ Is is OK to PAUSE / START the pipeline as I do ?</div>
<div><br></div><div>3/ I think I read somewhere that probes should not block, is that true for my case (for the source element) ? If yes I might have a problem then since the client pipeline have sometime to wait for the network simulation. Do think I should write a plug-in to do what I want and to generate the pipeline clock ?</div>
<div><br></div><div>thank you very much </div><div><br></div><div>Max</div><br>-- <br>Maxime Louvel<br>web page : <a href="https://sites.google.com/site/mlouvel/" target="_blank">https://sites.google.com/site/mlouvel/</a><br>
linkedin : <a href="http://fr.linkedin.com/in/mlouvel" target="_blank">http://fr.linkedin.com/in/mlouvel</a><br><div>address : 5400-B ridge oak drive</div><div>               Austin, Texas, 78731</div><div>               USA</div>
<br>