Ejemplo n.º 1
0
        public void SetDataSource_DataSourceCompletes_SignalsEos()
        {
            AsyncContext.Run(async() =>
            {
                var demuxerStub = Substitute.For <IDemuxer>();
                var dataSource  = new Subject <byte[]>();
                using (var controller = new DemuxerController(demuxerStub))
                {
                    controller.SetDataSource(dataSource);
                    var packetReadyTask = controller.PacketReady()
                                          .FirstAsync()
                                          .ToTask();

                    dataSource.OnNext(null);

                    var isEmpty = await packetReadyTask;
                    Assert.That(isEmpty, Is.Null);
                }
            });
        }
Ejemplo n.º 2
0
        public IDataProvider Create(ClipDefinition clip)
        {
            if (clip == null)
            {
                throw new ArgumentNullException(nameof(clip), "clip cannot be null");
            }

            if (!SupportsClip(clip))
            {
                throw new ArgumentException("unsupported clip type");
            }

            var rtspClient        = new RTSPClient();
            var demuxer           = new FFmpegDemuxer(new FFmpegGlue());
            var demuxerController = new DemuxerController(demuxer);

            demuxerController.SetDataSource(rtspClient.ChunkReady());

            return(new RTSPDataProvider(demuxerController, rtspClient, clip));
        }