diff --git a/src/whep-client.c b/src/whep-client.c index e313624..89a67fa 100644 --- a/src/whep-client.c +++ b/src/whep-client.c @@ -51,7 +51,7 @@ static GMainLoop *loop = NULL; static GstElement *pipeline = NULL, *pc = NULL; static const char *audio_caps = NULL, *video_caps = NULL; static gboolean no_trickle = FALSE, gathering_done = FALSE, - follow_link = FALSE, force_turn = FALSE; + follow_link = FALSE, force_turn = FALSE, no_decode = FALSE; static const char *stun_server = NULL, **turn_server = NULL; static char *auto_stun_server = NULL, **auto_turn_server = NULL; static int latency = -1; @@ -133,6 +133,7 @@ static GOptionEntry opt_entries[] = { { "log-timestamps", 'L', 0, G_OPTION_ARG_NONE, &whep_log_timestamps, "Enable logging timestamps (default: disabled)", NULL }, { "eos-sink-name", 'e', 0, G_OPTION_ARG_STRING, &eos_sink_name, "GStreamer sink name for EOS signal", NULL }, { "jitter-buffer", 'b', 0, G_OPTION_ARG_INT, &latency, "Jitter buffer (latency) to use in RTP, in milliseconds (default: -1, use webrtcbin's default)", NULL }, + { "no-decode", 'N', 0, G_OPTION_ARG_NONE, &no_decode, "Don't decode and play received RTP streams (ignores incoming traffic)"}, { NULL }, }; @@ -211,9 +212,12 @@ int main(int argc, char *argv[]) { } } WHEP_LOG(LOG_INFO, "Audio caps: %s\n", audio_caps ? audio_caps : "(none)"); - WHEP_LOG(LOG_INFO, "Video caps: %s\n\n", video_caps ? video_caps : "(none)"); + WHEP_LOG(LOG_INFO, "Video caps: %s\n", video_caps ? video_caps : "(none)"); + if(no_decode) + WHEP_LOG(LOG_WARN, "Ignoring incoming traffic (won't decode/play RTP streams)\n"); if(latency > 1000) WHEP_LOG(LOG_WARN, "Very high jitter-buffer latency configured (%u)\n", latency); + WHEP_LOG(LOG_INFO, "\n"); /* Initialize gstreamer */ gst_init(NULL, NULL); @@ -1262,9 +1266,10 @@ static void whep_incoming_decodebin_stream(GstElement *decodebin, GstPad *pad, g } } static void whep_incoming_stream(GstElement *webrtc, GstPad *pad, gpointer user_data) { - /* Create an element to decode the stream */ - WHEP_LOG(LOG_INFO, "Creating decodebin element\n"); - GstElement *decodebin = gst_element_factory_make("decodebin", NULL); + /* Create an element to decode (or ignore) the stream */ + const char *element = (no_decode ? "fakesink" : "decodebin"); + WHEP_LOG(LOG_INFO, "Creating '%s' element\n", element); + GstElement *decodebin = gst_element_factory_make(element, NULL); g_signal_connect(decodebin, "pad-added", G_CALLBACK(whep_incoming_decodebin_stream), pc); gst_bin_add(GST_BIN(pipeline), decodebin); gst_element_sync_state_with_parent(decodebin);