distinguish failed gstreamer elements

parent efc014c9
......@@ -165,14 +165,38 @@ main (int argc,
/* could also use autoaudiosink instead of pulsesink */
data.audiosink = gst_element_factory_make ("pulsesink", "sink");
data.audiosrc = gst_element_factory_make ("pulsesrc", "source");
if (!data.audiosrc || !data.audiosink) {
g_error ("Could not create audiosink or audiosrc");
return -1;
}
/* maybe we need to also explicitly add audioconvert and audioresample elements */
data.send_rtpbin = gst_element_factory_make ("rtpbin", "send-rtpbin");
data.recv_rtpbin = gst_element_factory_make ("rtpbin", "recv-rtpbin");
if (!data.send_rtpbin || !data.recv_rtpbin) {
g_error ("Could not create send/receive rtpbin");
return -1;
}
/* L16 codecs would need special handling, maybe simply drop it */
data.decoder = gst_element_factory_make (codec->gst_decoder_name, "decoder");
if (!data.decoder) {
g_error ("Could not create decoder %s", codec->gst_decoder_name);
return -1;
}
data.depayloader = gst_element_factory_make (codec->gst_depayloader_name, "depayloader");
if (!data.depayloader) {
g_error ("Could not create depayloader %s", codec->gst_depayloader_name);
return -1;
}
data.encoder = gst_element_factory_make (codec->gst_encoder_name, "encoder");
if (!data.encoder) {
g_error ("Could not create encoder %s", codec->gst_encoder_name);
return -1;
}
data.payloader = gst_element_factory_make (codec->gst_payloader_name, "payloader");
if (!data.encoder) {
g_error ("Could not create encoder %s", codec->gst_encoder_name);
return -1;
}
data.rtp_src = gst_element_factory_make ("udpsrc", "rtp-udp-src");
data.rtp_sink = gst_element_factory_make ("udpsink", "rtp-udp-sink");
data.rtcp_recv_sink = gst_element_factory_make ("udpsink", "rtcp-udp-recv-sink");
......@@ -180,6 +204,13 @@ main (int argc,
data.rtcp_send_sink = gst_element_factory_make ("udpsink", "rtcp-udp-send-sink");
data.rtcp_send_src = gst_element_factory_make ("udpsrc", "rtcp-udp-send-src");
if (!data.rtp_src || !data.rtp_sink ||
!data.rtcp_recv_sink || !data.rtcp_recv_src ||
!data.rtcp_send_sink || !data.rtcp_send_src) {
g_error ("Could not create UDP sinks or sources");
return -1;
}
data.send_pipeline = gst_pipeline_new ("rtp-send-pipeline");
data.recv_pipeline = gst_pipeline_new ("rtp-recv-pipeline");
......@@ -189,15 +220,6 @@ main (int argc,
bus_watch_send = gst_bus_add_watch (bus_send, bus_cb, &data);
bus_watch_recv = gst_bus_add_watch (bus_recv, bus_cb, &data);
if (!data.send_pipeline || !data.recv_pipeline ||
!data.audiosink || !data.audiosrc || !data.send_rtpbin || !data.recv_rtpbin ||
!data.decoder || !data.encoder || !data.depayloader || !data.payloader ||
!data.rtp_src || !data.rtcp_recv_src || !data.rtcp_recv_sink ||
!data.rtp_sink || !data.rtcp_send_src || !data.rtcp_send_sink) {
g_error ("Could not create all elements!");
return -1;
}
gst_bin_add_many (GST_BIN (data.recv_pipeline), data.depayloader, data.decoder,
data.audiosink, NULL);
gst_bin_add_many (GST_BIN (data.send_pipeline), data.payloader, data.encoder,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment