<div dir="ltr">Hello,<div><br></div><div><br></div><div>Project Description: </div><div><br></div><div>Streaming live audio over a point-to-point network (WiFi, 2.4GHz) using UDP/RTP.</div><div><br></div><div>       Attributes of highest priority:</div><div>       </div><div>       Audio quality (44.1KHz@16bits)</div><div>       Latency (< 30 ms)</div><div><br></div><div><br></div><div>Currently, the application successfully streams audio between host and target via WiFi with an initial latency (delay) in the range of 160 - 20 ms between host (input) and target (output). Aside from the initial delay, the latency will slowly increase (latency_drift, ~ 30 ms / min).</div><div><br></div><div>I have been attempting to synchronize the host and target pipeline clocks in the hope that it will stabilize the initial_latency and eliminate the latency_drift. However, I have been unsuccessful.</div><div><br></div><div>I have attempted to synchronize the pipeline clocks by implementing the GstNetTimeProvider and GstNetClientClock structures. I'm not sure if this method requires the use of the GstRTSPServer and GstRTSPMediaFactory structures or not. Audio failed to stream after implementation.</div><div><br></div><div>I added the GstRTSPServer and GstRTSPMediaFactory structures to the previous implementation, using the following programs as a guide:</div><div><br></div><div><a href="https://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples/test-netclock.c">https://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples/test-netclock.c</a><br></div><div><br></div><div><a href="https://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples/test-netclock-client.c">https://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples/test-netclock-client.c</a><br></div><div><br></div><div>Audio failed to stream after implementation.</div><div><br></div><div><br></div><div>Below is a snippet of the host application:</div><div><br></div><div><div><span style="white-space:pre">  </span>main_loop = g_main_loop_new (NULL, FALSE);</div><div><span style="white-space:pre">    </span>data.loop = main_loop;</div><div><span style="white-space:pre">        </span>data.pipe = pipe;</div><div><br></div><div><span style="white-space:pre">    </span>clock = gst_system_clock_obtain();</div><div><br></div><div><span style="white-space:pre">   </span>gst_net_time_provider_new(clock, "192.168.1.2", 5000);</div><div><br></div><div><span style="white-space:pre">     </span>/* create a server instance */</div><div><span style="white-space:pre">        </span>server = gst_rtsp_server_new ();</div><div><br></div><div><span style="white-space:pre">     </span>mounts = gst_rtsp_server_get_mount_points (server);</div><div><br></div><div><span style="white-space:pre">  </span>factory = gst_rtsp_media_factory_new ();</div><div><span style="white-space:pre">      </span>gst_rtsp_media_factory_set_launch (factory, "alsasrc buffer-time=200000 latency-time=5000                                                                    provide-clock=fasle ! audioconvert ! audio/x-raw,                                                                                channels=1, depth=16, width=16, rate=44100 !                                                                                  rtpL16pay ! udpsink host=192.168.1.1 port=5000");</div><div><span style="white-space:pre">    </span>gst_rtsp_media_factory_set_shared (factory, TRUE);</div><div><span style="white-space:pre">    </span>gst_rtsp_media_factory_set_clock (factory, clock);</div><div><span style="white-space:pre">    </span>gst_rtsp_mount_points_add_factory(mounts, "/tmp", factory);</div><div><br></div><div><span style="white-space:pre">        </span>g_object_unref(mounts);</div><div><br></div><div><span style="white-space:pre">      </span>gst_rtsp_server_attach(server, NULL);</div></div><div><br></div><div><br></div><div>Below is a snippet of the target application:</div><div><br></div><div><div><span style="white-space:pre">   </span>/* Create Pipeline */</div><div><span style="white-space:pre"> </span>pipeline = gst_pipeline_new("my-pipeline");</div><div><br></div><div><span style="white-space:pre">        </span>/* Get Pipeline Clock from Host */</div><div><span style="white-space:pre">    </span>clock = gst_net_client_clock_new("clock", "rtsp://<a href="http://192.168.1.2/tmp">192.168.1.2/tmp</a>", 5000, 0);</div><div><span style="white-space:pre">  </span>if (clock == NULL){</div><div><span style="white-space:pre">           </span>g_print("Failed to create net clock client");</div><div><span style="white-space:pre">               </span>return 1;</div><div><span style="white-space:pre">     </span>}</div><div><br></div><div><span style="white-space:pre">    </span>/* Wait for the clock to stabilize */</div><div><span style="white-space:pre"> </span>gst_clock_wait_for_sync(clock, GST_CLOCK_TIME_NONE);</div><div><br></div><div><span style="white-space:pre"> </span>gst_pipeline_use_clock(GST_PIPELINE(pipeline), clock);</div><div><br></div><div><span style="white-space:pre">       </span>/* Create Elements */</div><div><span style="white-space:pre"> </span>network = gst_element_factory_make("udpsrc", "network");</div><div><span style="white-space:pre">  </span>filter = gst_element_factory_make("capsfilter", "capsfilter");</div><div><span style="white-space:pre">    </span>packet = gst_element_factory_make("rtpL16depay", "packet");</div><div><span style="white-space:pre">       </span>convert = gst_element_factory_make("audioconvert", "audioconvert");</div><div><span style="white-space:pre">       </span>sink = gst_element_factory_make("alsasink", "sink");</div></div><div><br></div><div><br></div><div><br></div><div>Is this the best method for synchronizing the pipeline clocks?</div><div><br></div><div>Do I need to create a SDP file in the /tmp directory?</div><div><br></div><div><br></div><div>Any advice is greatly appreciated.</div><div><br></div><div>Thank you,</div><div><br></div><div>Trenton</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>