integrate gstreamer in discrete event simulation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

integrate gstreamer in discrete event simulation

Maxime Louvel
Hi everyone,

this is my first post on this list, I hope I'll make things right.
If no please tell me.

So, I want to integrate Gstreamer in a discrete event simulation environment (Omnet++).
I want to integrate network delay into a streaming application.
My idea is to execute the gstreamer pipelines (server and client) on a local PC.
Here are the pipelines corresponding to my application :

Server:
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 

Client:
 gst-launch -v -e udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" port=5000 ! rtph264depay ! capsfilter caps="video/x-h264,width=(int)640, height=(int)480, framerate=(fraction)25/1" ! qtmux ! filesink location=/tmp/video.mp4


Then I added probes on the udpsink pad to get the data that are going to be sent on the local socket.
This triggers network event in my simulation environment,
On the receiver pipeline, I want to add the network delay to the timestamp of the received packet.
I also want to simulate packet loss.
I've done that by adding a probe on the udpsrc pad.
 
here is the code I used :
...
pad = gst_element_get_pad (udpsrc, "src");
gst_pad_add_buffer_probe (pad, G_CALLBACK (c_udp_src_pad), NULL);
gst_object_unref (pad);
...

static gboolean c_udp_src_pad(GstPad *pad, GstBuffer *buffer, gpointer u_data)
{
   gboolean ret;
   gst_element_set_state (pipeline, GST_STATE_PAUSED);
   If (corresponding omnet packet is lost){
      ret=FALSE;
   }
   else{
      buffer->timestamp= buffer->timestamp + net_delay;
      ret = TRUE;
   }
   gst_element_set_state (pipeline, GST_STATE_PLAYING);
   return ret;
}

What I expect to have is :
 - the lost packets removed from the client pipeline
 - the network delay taken into account in the client pipeline.

My questions are :

1/ Is my approach correct ?

2/ Is is OK to PAUSE / START the pipeline as I do ?

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 ?

thank you very much 

Max

--
Maxime Louvel
web page : https://sites.google.com/site/mlouvel/
linkedin : http://fr.linkedin.com/in/mlouvel
address : 5400-B ridge oak drive
               Austin, Texas, 78731
               USA


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel