Exemplo n.º 1
0
        public Player(ConfBot config, Id id)
        {
            FfmpegProducer = new FfmpegProducer(config.GetParent().Tools.Ffmpeg, id);
            WebSocketPipe  = new WebSocketPipe();
            StallCheckPipe = new StallCheckPipe();
            VolumePipe     = new VolumePipe();
            Volume         = config.Audio.Volume.Default;
            EncoderPipe    = new EncoderPipe(SendCodec)
            {
                Bitrate = ScaleBitrate(config.Audio.Bitrate)
            };
            EncoderPipeHighQuality = new EncoderPipe(Codec.OpusMusic)
            {
                Bitrate = 192000
            };
            TimePipe = new PreciseTimedPipe {
                ReadBufferSize = EncoderPipe.PacketSize
            };
            TimePipe.Initialize(EncoderPipe, id);
            MergePipe    = new PassiveMergePipe();
            SplitterPipe = new PassiveSplitterPipe();

            config.Audio.Bitrate.Changed += (s, e) => EncoderPipe.Bitrate = ScaleBitrate(e.NewValue);

            MergePipe.Into(TimePipe).Chain <CheckActivePipe>().Chain(SplitterPipe);
            SplitterPipe.Chain(EncoderPipeHighQuality).Chain(WebSocketPipe);
            SplitterPipe.Chain(StallCheckPipe).Chain(VolumePipe).Chain(EncoderPipe);
        }
Exemplo n.º 2
0
        public Player(ConfRoot confRoot, ConfBot config, DedicatedTaskScheduler scheduler, Id id)
        {
            this.scheduler = scheduler;

            FfmpegProducer = new FfmpegProducer(confRoot.Tools.Ffmpeg, scheduler, id);
            StallCheckPipe = new StallCheckPipe();
            VolumePipe     = new VolumePipe();
            Volume         = config.Audio.Volume.Default;
            EncoderPipe    = new EncoderPipe(SendCodec)
            {
                Bitrate = ScaleBitrate(config.Audio.Bitrate)
            };
            TimePipe = new PreciseTimedPipe(EncoderPipe, id)
            {
                ReadBufferSize = EncoderPipe.PacketSize
            };
            MergePipe = new PassiveMergePipe();

            config.Audio.Bitrate.Changed += (s, e) => EncoderPipe.Bitrate = ScaleBitrate(e.NewValue);

            MergePipe.Into(TimePipe).Chain <CheckActivePipe>().Chain(StallCheckPipe).Chain(VolumePipe).Chain(EncoderPipe);
        }