From b70a58066cab33feb57b16e8ae6fa59ddba3af8e Mon Sep 17 00:00:00 2001 From: Derek Dai Date: Thu, 9 Mar 2017 17:48:53 +0800 Subject: [PATCH] miracle-wfdctl: send video only stream if no audio device specified --- src/ctl/wfd-out-session.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/ctl/wfd-out-session.c b/src/ctl/wfd-out-session.c index 1579cc7..c094786 100644 --- a/src/ctl/wfd-out-session.c +++ b/src/ctl/wfd-out-session.c @@ -570,7 +570,7 @@ static int wfd_out_session_create_pipeline(struct wfd_session *s) GError *error = NULL; const char **tmp; int r; - const char *pipeline_desc[96] = { + const char *pipeline_desc[128] = { "ximagesrc", "name=vsrc", "use-damage=false", @@ -610,19 +610,6 @@ static int wfd_out_session_create_pipeline(struct wfd_session *s) "async=false", "host=", wfd_out_session_get_sink(s)->peer->remote_address, "port=", uint16_to_str(s->stream.rtp_port, rrtp_port,sizeof(rrtp_port)), - "pulsesrc", - "do-timestamp=true", - "client-name=miraclecast", - "device=", quote_str(os->audio_dev, audio_dev, sizeof(audio_dev)), - "!", "audioconvert", - "!", "audio/x-raw,", - "rate=48000,", - "channels=2", - "!", "avenc_aac", - "!", "queue", - "max-size-buffers=0", - "max-size-bytes=0", - "!", "muxer.", "udpsrc", "address=", wfd_out_session_get_sink(s)->peer->local_address, "port=", uint16_to_str(LOCAL_RTCP_PORT, lrtcp_port,sizeof(lrtcp_port)), @@ -645,6 +632,30 @@ static int wfd_out_session_create_pipeline(struct wfd_session *s) *tmp ++ = NULL; } + if(*os->audio_dev) { + for(tmp = pipeline_desc; *tmp; ++tmp); + *tmp ++ = "pulsesrc"; + *tmp ++ = "do-timestamp=true"; + *tmp ++ = "client-name=miraclecast"; + *tmp ++ = "device="; + *tmp ++ = quote_str(os->audio_dev, audio_dev, sizeof(audio_dev)); + *tmp ++ = "!"; + *tmp ++ = "audioconvert"; + *tmp ++ = "!"; + *tmp ++ = "audio/x-raw,"; + *tmp ++ = "rate=48000,"; + *tmp ++ = "channels=2"; + *tmp ++ = "!"; + *tmp ++ = "avenc_aac"; + *tmp ++ = "!"; + *tmp ++ = "queue"; + *tmp ++ = "max-size-buffers=0"; + *tmp ++ = "max-size-bytes=0"; + *tmp ++ = "!"; + *tmp ++ = "muxer."; + *tmp ++ = NULL; + } + /* bad pratice, but since we are in the same process, I think this is the only way to do it */ if(WFD_DISPLAY_TYPE_X == os->display_type) {