public Ts3Full(Ts3FullClientData tfcd) : base(ClientType.Full) { tsFullClient = (Ts3FullClient)tsBaseClient; ts3FullClientData = tfcd; tfcd.PropertyChanged += Tfcd_PropertyChanged; ffmpegProducer = new FfmpegProducer(tfcd); stallCheckPipe = new StallCheckPipe(); volumePipe = new VolumePipe(); encoderPipe = new EncoderPipe(SendCodec) { Bitrate = ts3FullClientData.AudioBitrate * 1000 }; timePipe = new PreciseTimedPipe { ReadBufferSize = encoderPipe.PacketSize }; timePipe.Initialize(encoderPipe); TargetPipe = new CustomTargetPipe(tsFullClient); mergePipe = new PassiveMergePipe(); mergePipe.Add(ffmpegProducer); timePipe.InStream = mergePipe; timePipe.Chain <ActiveCheckPipe>().Chain(stallCheckPipe).Chain(volumePipe).Chain(encoderPipe).Chain(TargetPipe); identity = null; }
public Ts3Client(ConfBot config) { Util.Init(out clientDbNames); Util.Init(out clientbuffer); TsFullClient = new Ts3FullClient(EventDispatchType.DoubleThread); TsFullClient.OnClientLeftView += ExtendedClientLeftView; TsFullClient.OnClientEnterView += ExtendedClientEnterView; TsFullClient.OnTextMessage += ExtendedTextMessage; TsFullClient.OnErrorEvent += TsFullClient_OnErrorEvent; TsFullClient.OnConnected += TsFullClient_OnConnected; TsFullClient.OnDisconnected += TsFullClient_OnDisconnected; int ScaleBitrate(int value) => Math.Min(Math.Max(1, value), 255) * 1000; this.config = config; this.config.Audio.Bitrate.Changed += (s, e) => encoderPipe.Bitrate = ScaleBitrate(e.NewValue); ffmpegProducer = new FfmpegProducer(config.GetParent().Tools.Ffmpeg); stallCheckPipe = new StallCheckPipe(); volumePipe = new VolumePipe(); Volume = config.Audio.Volume.Default; encoderPipe = new EncoderPipe(SendCodec) { Bitrate = ScaleBitrate(config.Audio.Bitrate) }; timePipe = new PreciseTimedPipe { ReadBufferSize = encoderPipe.PacketSize }; timePipe.Initialize(encoderPipe); TargetPipe = new CustomTargetPipe(TsFullClient); mergePipe = new PassiveMergePipe(); mergePipe.Add(ffmpegProducer); mergePipe.Into(timePipe).Chain <CheckActivePipe>().Chain(stallCheckPipe).Chain(volumePipe).Chain(encoderPipe).Chain(TargetPipe); identity = null; }
public Ts3Client(ConfBot config, Ts3FullClient tsFullClient, Id id) { this.id = id; Util.Init(out clientDbNames); Util.Init(out clientbuffer); dbIdCache = new LruCache <string, ulong>(1024); this.tsFullClient = tsFullClient; tsFullClient.OnEachTextMessage += ExtendedTextMessage; tsFullClient.OnErrorEvent += TsFullClient_OnErrorEvent; tsFullClient.OnConnected += TsFullClient_OnConnected; tsFullClient.OnDisconnected += TsFullClient_OnDisconnected; int ScaleBitrate(int value) => Util.Clamp(value, 1, 255) * 1000; this.config = config; this.config.Audio.Bitrate.Changed += (s, e) => encoderPipe.Bitrate = ScaleBitrate(e.NewValue); ffmpegProducer = new FfmpegProducer(config.GetParent().Tools.Ffmpeg, id); stallCheckPipe = new StallCheckPipe(); volumePipe = new VolumePipe(); Volume = config.Audio.Volume.Default; encoderPipe = new EncoderPipe(SendCodec) { Bitrate = ScaleBitrate(config.Audio.Bitrate) }; timePipe = new PreciseTimedPipe { ReadBufferSize = encoderPipe.PacketSize }; timePipe.Initialize(encoderPipe, id); TargetPipe = new CustomTargetPipe(tsFullClient); mergePipe = new PassiveMergePipe(); mergePipe.Add(ffmpegProducer); mergePipe.Into(timePipe).Chain <CheckActivePipe>().Chain(stallCheckPipe).Chain(volumePipe).Chain(encoderPipe).Chain(TargetPipe); identity = null; }
public void MixInStreamOnce(StreamAudioProducer producer) { mergePipe.Add(producer); producer.HitEnd += (s, e) => mergePipe.Remove(producer); timePipe.Paused = false; }