Skip to content

Commit

Permalink
sendrecv/gst: Add no-op audio/video converters
Browse files Browse the repository at this point in the history
This reduces the chance that someone will try to change the
audio/video source elements and get an error because they don't know
about the conversion elements. They will be no-ops in the usual case.

Closes centricular#8
  • Loading branch information
nirbheek committed Mar 31, 2018
1 parent 302b1da commit 85f9572
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sendrecv/gst/webrtc-sendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ handle_media_stream (GstPad * pad, GstElement * pipe, const char * convert_name,
g_assert_nonnull (sink);

if (g_strcmp0 (convert_name, "audioconvert") == 0) {
/* Might also need to resample, so add it just in case.
* Will be a no-op if it's not required. */
resample = gst_element_factory_make ("audioresample", NULL);
g_assert_nonnull (resample);
gst_bin_add_many (GST_BIN (pipe), q, conv, resample, sink, NULL);
Expand Down Expand Up @@ -279,9 +281,9 @@ start_pipeline (void)

pipe1 =
gst_parse_launch ("webrtcbin name=sendrecv " STUN_SERVER
"videotestsrc pattern=ball ! queue ! vp8enc deadline=1 ! rtpvp8pay ! "
"videotestsrc pattern=ball ! videoconvert ! queue ! vp8enc deadline=1 ! rtpvp8pay ! "
"queue ! " RTP_CAPS_VP8 "96 ! sendrecv. "
"audiotestsrc wave=red-noise ! queue ! opusenc ! rtpopuspay ! "
"audiotestsrc wave=red-noise ! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay ! "
"queue ! " RTP_CAPS_OPUS "97 ! sendrecv. ",
&error);

Expand Down

0 comments on commit 85f9572

Please sign in to comment.