Add explicit audio converters to voice processor and echo probe
The VoiceProcessor and EchoProbe plugins have fixed caps: rate=48000,channels=1. There is no such cap on windows, hence append explicit resampler and converter.
This commit is contained in:
parent
fc2d2dab8d
commit
0ca02a72f4
|
@ -470,6 +470,30 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Object {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WITH_VOICE_PROCESSOR
|
||||||
|
private Gst.Element create_voice_processor() {
|
||||||
|
Gst.Bin bin = new Gst.Bin("voiceprocessorbin");
|
||||||
|
Gst.Element converter = Gst.ElementFactory.make("audioconvert", @"dsp_convert_$id");
|
||||||
|
Gst.Element resampler = Gst.ElementFactory.make("audioresample", @"dsp_resmaple_$id");
|
||||||
|
|
||||||
|
Gst.Element voiceproc = new VoiceProcessor(plugin.echoprobe as EchoProbe, element as Gst.Audio.StreamVolume);
|
||||||
|
voiceproc.name = @"dsp_$id";
|
||||||
|
|
||||||
|
bin.add_many(converter, resampler, voiceproc);
|
||||||
|
converter.link(resampler);
|
||||||
|
resampler.link(voiceproc);
|
||||||
|
|
||||||
|
Gst.Pad sink_pad = bin.find_unlinked_pad(Gst.PadDirection.SINK);
|
||||||
|
Gst.Pad src_pad = bin.find_unlinked_pad(Gst.PadDirection.SRC);
|
||||||
|
Gst.Pad ghost_source = new Gst.GhostPad("source", src_pad);
|
||||||
|
Gst.Pad ghost_sink = new Gst.GhostPad("sink", sink_pad);
|
||||||
|
bin.add_pad(ghost_source);
|
||||||
|
bin.add_pad(ghost_sink);
|
||||||
|
|
||||||
|
return (Gst.Element)bin;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private void create() {
|
private void create() {
|
||||||
debug("Creating device %s", id);
|
debug("Creating device %s", id);
|
||||||
plugin.pause();
|
plugin.pause();
|
||||||
|
@ -488,8 +512,7 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Object {
|
||||||
element.link(filter);
|
element.link(filter);
|
||||||
#if WITH_VOICE_PROCESSOR
|
#if WITH_VOICE_PROCESSOR
|
||||||
if (media == "audio" && plugin.echoprobe != null) {
|
if (media == "audio" && plugin.echoprobe != null) {
|
||||||
dsp = new VoiceProcessor(plugin.echoprobe as EchoProbe, element as Gst.Audio.StreamVolume);
|
dsp = create_voice_processor();
|
||||||
dsp.name = @"dsp_$id";
|
|
||||||
pipe.add(dsp);
|
pipe.add(dsp);
|
||||||
filter.link(dsp);
|
filter.link(dsp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,27 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WITH_VOICE_PROCESSOR
|
||||||
|
private Gst.Element create_echo_bin(Gst.Element element) {
|
||||||
|
Gst.Bin bin = new Gst.Bin("echoprobebin");
|
||||||
|
Gst.Element converter = Gst.ElementFactory.make("audioconvert", "echo_convert_");
|
||||||
|
Gst.Element resampler = Gst.ElementFactory.make("audioresample", "echo_resample_");
|
||||||
|
|
||||||
|
bin.add_many(element, converter, resampler);
|
||||||
|
element.link(converter);
|
||||||
|
converter.link(resampler);
|
||||||
|
|
||||||
|
Gst.Pad sink_pad = bin.find_unlinked_pad(Gst.PadDirection.SINK);
|
||||||
|
Gst.Pad src_pad = bin.find_unlinked_pad(Gst.PadDirection.SRC);
|
||||||
|
Gst.Pad ghost_source = new Gst.GhostPad("source", src_pad);
|
||||||
|
Gst.Pad ghost_sink = new Gst.GhostPad("sink", sink_pad);
|
||||||
|
bin.add_pad(ghost_source);
|
||||||
|
bin.add_pad(ghost_sink);
|
||||||
|
|
||||||
|
return (Gst.Element)bin;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private void init_call_pipe() {
|
private void init_call_pipe() {
|
||||||
if (pipe != null) return;
|
if (pipe != null) return;
|
||||||
pipe = new Gst.Pipeline(null);
|
pipe = new Gst.Pipeline(null);
|
||||||
|
@ -80,7 +101,10 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
|
||||||
#if WITH_VOICE_PROCESSOR
|
#if WITH_VOICE_PROCESSOR
|
||||||
// Audio echo probe
|
// Audio echo probe
|
||||||
echoprobe = new EchoProbe();
|
echoprobe = new EchoProbe();
|
||||||
if (echoprobe != null) pipe.add(echoprobe);
|
if (echoprobe != null) {
|
||||||
|
echoprobe = create_echo_bin(echoprobe);
|
||||||
|
pipe.add(echoprobe);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pipeline
|
// Pipeline
|
||||||
|
|
Loading…
Reference in a new issue